Question for the latex gurus in the audience.

One popular complaint about lyx 1.0 is that you can't get the equivalent of
\section[short]{long section title}.

Well, perhaps this has been discussed before, but couldn't you do something
like this in the preamble (I don't know TeX, so this is sort of pseudoTeX):

\newcommand{\shortsection}[1]{\let\shortsectionname=#1}
% Initialie shortsectionname to nothing by default.
% however you set something to "" in TeX
\let\shortsectionname=

\def\mysection\section

\renewcommand{\section}[1]{%
\if\shortsectionname isn't null\let\optarg=\shortsectioname%
\else\let\optarg=#1
\mysection[\optarg]{#1}
\let\shortsectionname=}
}

And in the .layout file:

Style Shortsection
    name = shortsection
EndStyle

Ignoring the probably laughable syntax & methodology, you can see that I'm
trying to say that you would write the short title for the chapter first,
in Shortsection style, and then you would write a Section title like usual.
The \shortsection command would set the variable \shortsectionname to the
short section name the user input, and then the renew'ed \section command
would print it out correctly, or print nothing. (I wanted to just say
\mysection[\shortsectionname]{#1} but that would make an empty entry in the
TOC, which is wrong.

Since this doesn't require changing LyX code, I would contend that it won't
break anything. I'm probably wrong. But please tell me why.

The actual reason I'm interested is that revtex lets you use optargs for
\title and a bunch of other fields in the title. If we want to "market" this
thing for clueless professors, we shouldnt' require them to reedit the thing
when they're done. (Of course, APS still isn't accepting submissions in
revtex4, so maybe we can just wait for 1.2.)

-Amir

Reply via email to