On 2011-10-06, Spyros Stathopoulos wrote:
...

> In my opinion, however, it would be ideal if there was a way to
> configure when preamble statements are loaded (before or after lyx
> ones), but given the complexity that such a change would imply the
> current design is understandable.

You are right, there are several occasions, when inserting custom code
*before* the LyX-generated preamble would make "power configuration" easier.

However, in most cases this would be required in addition to the standard
(post-auto) LaTeX preamble, so a switch would not solve the problem.

Possible solutions include a second input field (maybe as fold-out or
with a draggable separator) inside the "LaTeX Preamble" tab:
  
  Custom LaTeX code before LyX-generated preamble:                  
  +-----------------------------------------------------------------+
  | \usepackage[put]{mathdesign}                                    |
  |                                                                 |
  +-----------------------------------------------------------------+
  Custom LaTeX code after LyX-generated preamble:
  +-----------------------------------------------------------------+
  | \input{mypreamble}                                              |
  |                                                                 |
  |                                                                 |
  +-----------------------------------------------------------------+
  
However, there might, e.g. even be some code to put before \documentclass
and some code after \documentclass. For such a flexibility, the Docutils
latex writer uses an export-document template that can be replaced with a
custom one in a power-user command line option:

--template=<file>       Specify the template file. Default: "default.tex".

with default.tex:

$head_prefix% generated by Docutils <http://docutils.sourceforge.net/>
\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
$requirements
%%% Custom LaTeX preamble
$latex_preamble
%%% User specified packages and stylesheets
$stylesheet
%%% Fallback definitions for Docutils-specific commands
$fallbacks$pdfsetup
$titledata
%%% Body
\begin{document}
$body_pre_docinfo$docinfo$dedication$abstract$body
\end{document}


Günter

Reply via email to