Enrico Forestieri wrote:
> Try the following:
>
> \let\oldcaption\caption
> \def\takeshort#1.#2\next{\gdef\short{#1}\gdef\everything{{\bfseries #1}.~~#2}}
> \def\caption#1{\takeshort#1\next\oldcaption[\short]{\everything}}
>
>> I am a bit confused... Why there is such a big difference in the effects
>> of \bfseries and \emph? Any ideas how I can typeset only the first part
>> in bold face?
>
> Because \bfseries doesn't take an argument. It affects everything in its
> scope, so the trick is limiting the scope by braces.
Okay, understood.
(TexKnowledge++;)
> Note that the above macros also work when there is only one dot in the
> caption. In this case, maybe you don't want a boldened caption, so the
> following could be more appropriate:
>
> \let\oldcaption\caption
> \def\takeshort#1.#2\next{\gdef\short{#1}\def\two{#2\relax}%
> \gdef\everything{\if\two\relax #1.\else{\bfseries #1}.~~#2\fi}}
> \def\caption#1{\takeshort#1\next\oldcaption[\short]{\everything}}
Enrico, you are the man!
I was just about asking for help for such kind of extension :-)
I already got the if-else part done, but it did not work. I think the
reason were the missing \relax commands. Now, after I found them in your
solution I looked them up and I think that I understand what was happening.
(TexKnowledge += 5;)
Thanks a lot!
Daniel