[Request/idea] Preamble generalization

Richard Kimberly Heck rikiheck at lyx.org
Sat Aug 15 16:09:45 UTC 2020


On 8/15/20 4:41 AM, Lorenzo Bertini wrote:
>> UI-wise, this would probably be better than what we have, but you can
>> already do this with Local Layout. Like this:
>>
>> Format 61
>>
>> AddToHTMLPreamble
>>
>> <style>
>> h2.section { font-size: 150%; font-weight: bold; }
>> </style>
>>
>> EndPremable
>>
>> You can put anything else in there that you want in the head block, too.
>>
>> Do feel free to file an enhancement request on the bug tracker.
>>
>> Riki
> Thank you, this solves some problems for me. However now I'm
> questioning whether the <LaTeX preamble> section in document->settings
> isn't just a shortcut for <AddToPreamble ... EndPreamble> in <local
> layout>? In this case I think putting them at the same level is
> confusing, and prevented me from ever needing to look deeper in <local
> layout>; I understand not all users would want to learn this but it's
> three lines to get a LaTeX or HTML preamble. Ideally there would be a
> way to keep the generality of the <local layout> section that however
> makes it super easy and intuitive to change a preamble.

I can see why it might seem that way, but these are quite different in
principle. The Local Layout box is really intended for layout code, like
you'd find in a module, but which is document-specific (not something
you really want to be able to reuse). E.g., I sometimes need a specific
kind of list for one document, so I put the layout code there. It's
basically a side-effect of the fact that the AddTo...Preamble tags exist
in layout code that one can put preamble info there as well. But I
wouldn't really recommend it if you're going to have very much preamble
code.

There's a long-standing request, actually, for there to be TWO preamble
boxes, whose contents are output at different times (before and after
other code that LyX generates). I'm actually not sure whether the layout
code from Local Layout (or from layout code more generally) is output
before or after the code in the Preamble box. So these may not actually
be equivalent.

> I leave this decision to you and I'll not file a bug (feature) report
> for now, but here's my two cents for keeping things clear and
> functional:
> 1) <LaTeX preamble> section gets removed
> 2) <local layout> section gets an "advanced" tab with the text entry
> we have now, and an "easy" tab made by text boxes, buttons and toggles
> (for a start, just containing the infamous LaTeX Preamble and HTML
> Preamble, then maybe more).
> Except for the advantages in clarity on preambles, I think this would
> make way easier not only to tinker with layouts but also to learn how
> Lyx works and what are the commands. I know this is a bit of an
> overhaul, I'm just leaving this here as an idea.

The complete version of this would give us a kind of GUI layout
editor---another longstanding request and something of a holy grail.
It's possible, presumably, but has proven difficult.

Riki




More information about the lyx-devel mailing list