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?
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.
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