On Tue, 29 Oct 2013 16:43:02 +0000 (UTC)
Mark Horton <mark.horton...@yahoo.co.uk> wrote:

> Hi I am a beginner in Lyx and understand a bit about the principles
> of Latex. I understand the advantages of a "fixed" layout and have
> seen some code to create a simple one. However it looks like a very
> steep learning curve. 

Hi Mark,

You're exactly right. LaTeX, and therefore layouts, have a steep
learning curve. I'd recommend you make your first one in the same
directory as your document, but test it with a tiny test document.

> 
> All I would like to do is 2 little adjustments to the standard "book"
> layout. It looks fine on A4 paper but when dropping down to A5 paper
> the space around the Chapter heading text is too big and the Chapter
> heading text is too big.
> 
> I believe there are two possible routes, something about a "local"
> module to override current settings which would be best. Or if
> possible get the original source for the book layout and create my
> own local layout from it. (But I wouldn't know where to find that..
> or if it is available)

That's a last resort, Mark. It's best just to specify only the changes,
if possible, rather than rewriting the whole environment and modifying
it.

Here's the idiomatic way people specify the changes:

\let\oldmiscstyle=\miscstyle
\let\endoldmiscstyle=\endmiscstyle
\renewenvironment{miscstyle}{
        %%% Stuff to do before invoking original environment
        \begin{oldmiscstyle}
        %%%% Stuff to do after invoking original, but before the text
}{
        %%%% Stuff to do before ending original, but after text
        \end{oldmiscstyle}
        %%%% Stuff to do after original environment ends
}


Mark, if you've been a software developer in the past, the line with
\endoldmiscstyle probably looks like Voodoo, especially given that
neither \endoldmiscstyle nor \endmiscstyle is ever mentioned again. Do
it anyway: Somehow, when an environment \whatever is made, LaTeX seems
to make a corresponding \endwhatever that gets executed upon
\whatever's completion. I've personally had situations where this idiom
didn't work unless I put in the line:

\let\endoldmiscstyle=\endmiscstyle

It's best not to give too much thought to such thing as it could screw
up your brain --- just do it.

> 
> So much for the principle. Any advice on where to find out about the
> practice (at beginner level) would be appreciated.

I gave a beginners-eye view of making your own layout here:

http://www.troubleshooters.com/lpm/200210/200210.htm#_MakingYourOwnLayout

If I were you, I'd read the entire document, in order. 

http://www.troubleshooters.com/lpm/200210/200210.htm

I'd estimate it would be about a day to assimilate all the information,
and you'll get back your day after writing 200 pages of LyX-authored
content, and from then on you'll benefit from the knowledge.

WARNING WARNING WARNING WARNING

My document was written before LyX had a great facility for placing the
layout file in the local directory. Unless you have a reason to believe
that you'll use the same layout for lots of books (I never have), then
use current directory layouts, like this:

Document->Settings->Document_class->Local_layout_button


WARNING: DEFINITION ALERT!!!!!!!!

LyX now has two different definitions for "Local Layout". Definition 1:
Document->Settings->Document_class->Local_layout_button

Definition 2: 
Document->Settings->Local_layout

Definition 1 refers to a layout file in the same directory as the
document. Definition 2 refers to putting the text you would normally
put in a layout file, into the document itself.

I personally always do it with Definition 1 because I can use my editor
of choice (which of course is Vim), and because I don't have to deal
with the hassles of the Validate button.

When you use a Definition 1 layout file, be sure to Tools->Reconfigure
and then restart LyX after every change to the layout file. This hassle
is one reason I recommend a small test document while building and
fine-tuning your layout. I often put everything in a shellscript that
loops. There are people on this list who know how to do a reconfigure
from the command line: Ask them how to do that --- makes it easier, but
be careful, you need to be in the right directory when you issue that
command.

Lastly, I'd like to congratulate you. There are people in this world
who say "Oh, LyX is trivially easy, anyone can use it!". Those people
have no credibility with me, because they've obviously always used
LyX defaults and have never made layout files. In making your layout
file, you become a LyX journeyman, with its attendant credibility.

Thanks,

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance

Reply via email to