Lyx user writes:

> 
> I would like to insert code in my preamble that will replace every instance of
> 
> \caption{Short. Long long long long.}
> 
> with
> 
> \caption[Short]{Short. Long long long long.}
> 
> However, I am not too familiar with LaTeX and TeX commands. Specifically, I
> don't know how to extract the text before the '.' character. After that I 
> think
> a macro and \renewcommand would finish the job. Can anyone help me?

Sure. Put the following in the preamble:

\let\oldcaption\caption
\def\takeshort#1.#2\next{\gdef\short{#1}\gdef\everything{#1.#2}}
\def\caption#1{\takeshort#1\next\oldcaption[\short]{\everything}}

-- 
Enrico

Reply via email to