2

Spinoff question from here where the solution required some handwritten LaTex and some LyX manouvers. So how can you encapsulate the code like the below to make it look nice in LyX?

enter image description here

  • I think my answer is correct. Do you have any feedback? – G.M. Apr 27 '16 at 17:51
  • @G.M. can you link the customization manual in your answer? I cannot find it with a search, some here? – hhh Apr 28 '16 at 17:20
  • Within LyX, see Help > Customization – G.M. Apr 28 '16 at 21:20
  • @G.M. Help > Customization > 5.4 Tags for XHTML output is the only section where custom insets are mentioned, is this right part of the manual? – hhh Apr 29 '16 at 11:47
  • The whole of Section 5 should be relevant, but especially 5.3.4 and 5.3.9 (depending on what you are looking for). Now, in practice I start from existing layouts from the lyx layouts directory. – G.M. Apr 29 '16 at 18:06
2

You can define custom insets as per the Customization manual. Here's an example to write in Document parameters > Local layout and to fill in with your code:

InsetLayout Flex:MyLandscape
        LyxType custom
        LabelString "Landscape"
        Decoration  classic
        MultiPar    true
        LatexType   command
        LatexName   mylandscape
        Argument 1
                LabelString "Caption"
                MenuString  "Landscape caption"
                Mandatory   1
                Autoinsert  1
        EndArgument
        Preamble
\def\mylandscape#1#2{...your LaTeX code...}
        EndPreamble
        Requires rotating, graphicx
End

Do not forget to validate and then to convert to latest format which adds the relevant Format tag.

You can now introduce the MyLandscape inset from Insert > Custom insets.

This might not be necessary for this particular code because as I understand you have found how to set a table in landscape from the lyx interface. But this will adapt to similar scenarios.

The simplest way to learn how to define new layouts is to see how things are done in lyx's layout folder, and read the Customization manual in case of doubt.

You can also turn your local layout into a module, refer to the Customization manual for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.