On 10/04/2016 12:40 PM, racoon wrote:
> I used to insert section labels right after the heading:
>
> 1. Some heading[sec:Some-heading]
>
> This is actually how it is done in the User Guide as well. However,
> this produces the following source:
>
> \section{Some heading\label{sec:Some-heading}}
>
> But it actually leads to problems when I tried to have uppercase
> section headings with:
>
> \usepackage{sectsty}
> \sectionfont{\MakeUppercase}
>
> I guess the error occurs for the same reason as
> \MakeUppercase{\label{sec:Some-heading}} generates an error.

Yes, it can cause other problems too. The root cause is that \section is
a "moving argument". You really don't want to put anything else in
there. Though I'll confess I sometimes do.

> So I looked around and saw that often the label is inserted *after*
> the section:
>
> \section{Some heading}\label{sec:Some-heading}
>
> But I am not sure how to achieve this with LyX. So instead I did this:
>
> 1. Some heading
> [sec:Some-heading]
>
> Where the label is just inserted in an extra default paragraph. Apart
> from looking a bit odd, it seems to work and not to create extra
> spacing or so. So is this the "saver" way to insert section labels in
> LyX?

You can also just put the label at the beginning of the text. If there's
no such text (if the first thing is a \subsection), then you can put it
on a blank line by itself. LaTeX will ignore the otherwise empty line.

Richard

Reply via email to