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.

  • 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
2

You can try

AddToPreamble
\usepackage[this]{that}
EndPreamble

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

  • 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 7:04

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.