0

When adding something to the LyX preamble and converting to TeX, it adds the lines after LyX package imports (\usepackage{amsmath} and the like), after LyX specific LaTeX commands (\pdfpageheight\paperheight), and after Textclass specific LaTeX commands:

\theoremstyle{definition}
\newtheorem{defn}{\protect\definitionname}

I would like to import a package at the same time the "normal" packages are imported (amsmath, etc.). I saw this question and the accepted answer seemed relevant, but I can't make it work. When I add:

PackageOptions mypackage foo
Requires mypackage

to the Local Layout, it adds the line \PassOptionsToPackage{foo}{mypackage} before the \usepackage lines, but nothing else.

Ted
  • 195
  • I've asked your questions like yours before, so I understand if you cannot, but it would be helpful if you asked what you really want to do and give a minimal example of something where you get an error. – scottkosty Jun 15 '17 at 19:43

1 Answers1

2

You can try

AddToPreamble
\usepackage[this]{that}
EndPreamble

in the local layout, cf. Help --> Customization, section 5.3.4.

Torbjørn T.
  • 206,688
  • This almost works: it puts it before Textclass specific LaTeX commands, but before Textclass commands. – Ted Jun 16 '17 at 22:08
  • 1
    @Ted I'm guessing a bit here, but to get full control you probably need to make a new layout file. Start with a copy of the one corresponding to the documentclass you use, e.g. article.layout (on my system that is found in /usr/share/lyx/layouts/, place the modified copy in the user directory) – Torbjørn T. Jun 17 '17 at 07:04