TransWikia.com

Can one "fold" part of the paragraphs in LyX

TeX - LaTeX Asked by chap on March 15, 2021

By “folding”, I mean condense some part of the codes, and by one click , you can unfold them.

3 Answers

OK, since this have remained unanswered for a while, I will retype my comment here. LyX does have some folding, you can for example fold notes, ERT, tables and other inserts. However, general folding is not implemented at the moment. It is on the wishlist.

Answered by Jan Hlavacek on March 15, 2021

While LyX has not yet "traditional" functionality for general editor folding, it can relatively easy be simulated by using LyX branches. As branches are insets, they can be folded within LyX. (By activating/deactivating them, you could even fold them in the output, but that is another story.)

enter image description here

To fold some content, just select it and then choose Insert->Branch from the menu. If you do this the first time, you have to create the respective branch (e.g., "Folded"); afterwards, you can just put more content into the "Folded" branch. For quick access, it is possible and recommended to bind this function to a keyboard shortcut.

Note that a new branch is deactivated by default, which means that its content will not appear in the output. You can change this by right-clicking on the inset.

Answered by Daniel on March 15, 2021

As an alternative to (ab)using branches, one can easily define a custom inset by adding the following to Document > Settings > Local Layout:

InsetLayout Flex:Foldable          # Define a new "flex" inset called "Foldable"
  LyxType         custom           # Add to Insert > Custom Insets
  LatexType       none             # Export contents to latex as-is, ignoring the wrapper.
  Decoration      minimalistic     # Do not show a label, only the outer box, when not folded.
  ContentAsLabel  true             # When folded show truncated contents as label.
End

Usage

The inset can be inserted from the menu entry Insert > Custom Insets > Foldable of by typing M-x flex-insert Foldable.

For multi-file documents, the Local Layout has to be manually replicated across all files.

Answered by kdb on March 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP