On 03-Jan-12 4:11 pm, Richard Heck wrote:
On 01/03/2012 03:45 AM, Guenter Milde wrote:
On 2012-01-01, Bogdan wrote:
On 01-Jan-12 6:07 pm, Uwe Stöhr wrote:
Am 01.01.2012 16:15, schrieb Richard Heck:
On 12/31/2011 05:51 PM, Bogdan wrote:
Is there *any* way to make LyX add latex code before the
\documentclass{} call?
I do not think so.
And I have never seen this and I doubt that this will work because
without loading the document class or any package, you cannot do much.
There are several use cases. I remember a similar request some time
(maybe
years) ago. A "hook" for pre-documentclass code could also solve some
of the
"how do I configure auto-loaded packages" problems.

I could imagine a layout keyword like

PrePreamble
% this should appear before the \documentclass call in the latex source
EndPrePreamble

This could then be used by layouts like "IEEEtranA4" as well as
in idividual documents via the local layout feature.
If this is definitely needed, it is easy to provide it. Adding Layout
stuff is fairly trivial. I guess the question was: Do we need it? or is
there some other way around this?

Richard

I guess the "need" question depends on the time and attitude of the devs. I agree that most users probably do not need it and then you as devs may argue that you don't want to bother for a minority. However, LyX is a truly great piece of software and would be nice to cover all user base, not just the majority (granted, the latter could be overwhelming).

I for one needed this fairly often for the IEEEtran class. In a reply to this thread I pointed to the official IEEEtran FAQ which requires code before \documentclass{} in order to set page margins: http://article.gmane.org/gmane.editors.lyx.general/73642

I also found older requests for this in the LyX list from users that were in the same situation: http://article.gmane.org/gmane.editors.lyx.general/50299

In my previous reply to this topic, I provided a hack that makes it possible (converter wrapper that parses and replaces the .tex output of LyX on the fly based on a placeholder in the LyX document class options before passing it to pdflatex). I did it in a matter of minutes so I believe (or want to believe) that it's trivial for the devs to add an extra text field next to the document class options field for code that goes before \documentclass{}.

See my hack here: http://article.gmane.org/gmane.editors.lyx.general/73663

Bogdan.

--
Bogdan Roman, http://www.cl.cam.ac.uk/~abr28/
Computer Laboratory, University of Cambridge

Reply via email to