John McCabe-Dansted wrote:
Often proceedings give authors sample .tex files to demonstrate how a
paper should be formatted. I generally want to make my preamble as
close as possible the sample.

My recommendation:
Copy the sample preamble into the Document->Settings->Latex preamble.
Leave all other document settings at "Default". This way, you get the
sample preamble with very little extra. The sample preamble can set fonts, page layout and a lot of other options without LyX intruding.

Usually I can trick LyX into generating
something pretty close to the sample preamble, but before submitting
manually tweak the .tex file to remove unneeded options etc. For lolz,

What unwanted options do LyX put in the preamble for you?
With everything set to "default", I get:
\documentclass[norsk]{article}
\usepackage[T1]{fontenc}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{babel}

secnumdepth and tocnumdepth lack a "default" setting. Perhaps it'd be useful with a checkbox "Default Depths" similiar to the "Default Margins" we already have. It'd implicate that latex, the preamble commands, or some package makes the decision.

Paragraph separation must be set to "Indentation", or there will be more preamble commands. This setting ought to be relabeled "Default (indentation)". Because it doesn't force indentation, it merely does nothing and the latex default happens to be indentation.

It is necessary to select language and document class. Providing "default" for these is dangerous, because it won't work without explicit preamble commands. There is no "default" document class.

I spend a couple of days in LyX getting the pagination just right,
then discover that the pagination changes once I manually fix the
preabmle in the .tex file. Additionally, it is much faster to
cut-and-paste a preamble than it is to hunt round in LyX to find all
the options.  For these reasons, I use a wrapper script around
pdflatex like the one below.

Hunting around takes time, but it can be a one-time job.
Once you set up an empty document with "all defaults", save it as a template for future work.


However I was wondering if this sounds like a good feature for LyX itself?


My suggested implementation would be that you can set an option in
Document Settings->LaTeX Preamble like "edit whole preamble". When
this option is set LyX copies the whole preamble into the text box,
and allows the user to edit it as normal text.


Problems with this:

What if someone uses this, and changes the document settings later? Resynchronizing the preamble and document settings is a pain. First there is the parsing of the preamble text. And one can obviously type preamble commands that aren't supported in the settings.

Also, a given preamble may not implement everything. If you use a figure, then you expect the graphics package to be loaded. But maybe the given custom preamble doesn't do that, because not all articles need figures. Similiar for all the symbols one might want to use, color, math constructs and so on. LyX does this automatically, but then it must be allowed to modify the preamble. That is very hard if the preamble also is presented as modifiable text.

Would it be useful if Lyx came with a template document with everything set to default, in order to have a minimum automatic preamble?

Helge Hafting

Reply via email to