Re: Where to insert section labels?

2016-10-04 Thread racoon



On 04.10.2016 23:16, Richard Heck wrote:

On 10/04/2016 05:05 PM, racoon wrote:

On 04.10.2016 20:02, Richard Heck wrote:

On 10/04/2016 12:40 PM, racoon wrote:

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.


I just noticed that LyX in a sense supports neither my (in an extra
line) nor your (at the beginning of the text). This is because LyX
does not add the "sec:" to the label and also automatically inserts
the beginning of the text rather than the heading.


I do get the "sec:" on a blank line, and even at the beginning of the
first paragraph. But you are right that the auto-fill mechanism gives
you the text from the paragraph, or no text.

It would be pretty easy to change that, I think. Have a look at
Text::getPossibleLabel. You'll see there's some fancy footwork to get
the "sec:" part to work. If you did that before filling the "text"
variable, then...well...maybe there'd be other problems, but it would
solve this problem, I think.


Yes, you are right. I get the "sec:" too. Thanks for the ref. I'll take 
a look at it.


Daniel


Re: Where to insert section labels?

2016-10-04 Thread Richard Heck
On 10/04/2016 05:05 PM, racoon wrote:
> On 04.10.2016 20:02, Richard Heck wrote:
>> On 10/04/2016 12:40 PM, racoon wrote:
>>> 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.
>
> I just noticed that LyX in a sense supports neither my (in an extra
> line) nor your (at the beginning of the text). This is because LyX
> does not add the "sec:" to the label and also automatically inserts
> the beginning of the text rather than the heading.

I do get the "sec:" on a blank line, and even at the beginning of the
first paragraph. But you are right that the auto-fill mechanism gives
you the text from the paragraph, or no text.

It would be pretty easy to change that, I think. Have a look at
Text::getPossibleLabel. You'll see there's some fancy footwork to get
the "sec:" part to work. If you did that before filling the "text"
variable, then...well...maybe there'd be other problems, but it would
solve this problem, I think.

Richard



Re: Where to insert section labels?

2016-10-04 Thread Richard Heck
On 10/04/2016 04:52 PM, Jean-Marc Lasgouttes wrote:
> Le 04/10/2016 à 18:40, racoon a écrit :
>> 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.
>
> This is the subject of bug #2154, still not fixed after 11 years...
> http://www.lyx.org/trac/ticket/2154
>
> It is not very easy, we are not completely sure of what we want.

Yup, that's the discussion I mentioned in a different message.

Richard



Re: Where to insert section labels?

2016-10-04 Thread racoon

On 04.10.2016 20:02, Richard Heck wrote:

On 10/04/2016 12:40 PM, racoon wrote:

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.


I just noticed that LyX in a sense supports neither my (in an extra 
line) nor your (at the beginning of the text). This is because LyX does 
not add the "sec:" to the label and also automatically inserts the 
beginning of the text rather than the heading.


Maybe LyX could check whether the label is referring to the section or 
not. Or more easily to implement, I guess, check whether the label is 
inserted at the beginning of a default paragraph right after the 
\subsection. This would make both of our suggestions supported.


Daniel


Re: Where to insert section labels?

2016-10-04 Thread Jean-Marc Lasgouttes

Le 04/10/2016 à 18:40, racoon a écrit :

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.


This is the subject of bug #2154, still not fixed after 11 years...
http://www.lyx.org/trac/ticket/2154

It is not very easy, we are not completely sure of what we want.

JMarc


Re: Where to insert section labels?

2016-10-04 Thread racoon

Thanks Richard!

On 04.10.2016 20:02, Richard Heck wrote:

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.


Maybe worth changing that in the documentation files then.


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.


Yes that seems a bit nicer.

Maybe LyX could automatically put labels after the \section{} when it is 
put in the same line. But I don't know whether this would have other 
undesired consequences.


Daniel



Re: Where to insert section labels?

2016-10-04 Thread Michael Berger


On 10/04/2016 06: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.


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?


Daniel



Hi Daniel,
I am not quite sure what you mean.
But this is how I insert a section:

I type : 'New Section' as a name
With the cursor somewhere inside/before/behind that name I select: 'Section'
And I get: '3.8 Section Extra' in the appropriate format

Selecting 'Section*' would  do the same without numbering
Michael


Re: Where to insert section labels?

2016-10-04 Thread Richard Heck
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



Where to insert section labels?

2016-10-04 Thread racoon

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.


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?


Daniel



Re: section labels

2006-08-01 Thread Juergen Spitzmueller
Dr. Gyorgy Pota wrote:
> I use the last version of Lyx for Windows. My document consists of a
> main document and included child documents. When I label any section in
> any child document, a number of errors occurs in the conversion by Yap
> but none of the error descriptions refers to  the section label.  When  
> the  section label is removed  the  conversion by Yap  takes place
> normally.  If I convert a child document separately, everything is
> allright even if the section label is present.  But in this case I
> cannot see the whole document, e. g. important cross references are  
> absent. What is your opinion?

Known bug:
http://bugzilla.lyx.org/show_bug.cgi?id=2154

Comment #2 in the report describes a workaround.

Jürgen


section labels

2006-08-01 Thread Dr. Gyorgy Pota

Dear Users,

I use the last version of Lyx for Windows. My document consists of a 
main document and included child documents. When I label any section in 
any child document, a number of errors occurs in the conversion by Yap 
but none of the error descriptions refers to  the section label.  When  
the  section label is removed  the  conversion by Yap  takes place 
normally.  If I convert a child document separately, everything is 
allright even if the section label is present.  But in this case I 
cannot see the whole document, e. g. important cross references are  
absent. What is your opinion?


With best wishes,

Gyorgy Pota

--

Dr. Gyorgy Pota
associate professor
Institute of Physical Chemistry
University of Debrecen
H-4010 Debrecen, P. O. Box 7,
Hungary
Tel.: (36) 52-512-90022383
Fax: (36) 52-512-915
homepage: http://dragon.unideb.hu/~wwwphch/potae.htm