Re: Cross-referencing a new environment

2007-02-21 Thread Helge Hafting

Ramon Flores wrote:

Em Sexta, 16 de Fevereiro de 2007 17:36, o Richard Heck escreveu:
  

This looks to be more a LaTeX issue than a layout issue. Instead of

\addtocounter{exemplo}{1}

use

\refstepcounter{exemplo}

The latter both steps the counter and makes it the target for
cross-references. Otherwise, the target remains whatever it was,
probably section, which is why you're seeing the "1".



Thanks Richard. You are right, and now my layout works almost well.

 The remanent problem is that when making a cross reference of an "exemplo" it 
apears only a number, corresponding to the exemplo counter. Ex:


. . . As we seen in exemple 3

But I would like that the number of the chapter were also writen. Ex:

. . . As we seen in exemple 2.3
(3rd example of the second chapter).

Something lacks, but what?
  

Replace \newcounter{exemplo} with something like
\newcounter{exemplo}[chapter]
It will now be reset whenever "chapter" is incremented,
you probably want that. (Or if you don't - drop the [chapter] part)

\ref will use \theexemplo to print the number, so
redefine it something like
\renewcommand{\theexemplo}{\thechapter [EMAIL PROTECTED] [EMAIL PROTECTED]

Now your references will print 2.1, 2.2, 2.3 and so on for
"exemplos" in chapter 2.

Helge Hafting



Re: Cross-referencing a new environment

2007-02-21 Thread Ramon Flores
Em Sexta, 16 de Fevereiro de 2007 17:36, o Richard Heck escreveu:
> This looks to be more a LaTeX issue than a layout issue. Instead of
>
> \addtocounter{exemplo}{1}
>
> use
>
> \refstepcounter{exemplo}
>
> The latter both steps the counter and makes it the target for
> cross-references. Otherwise, the target remains whatever it was,
> probably section, which is why you're seeing the "1".

Thanks Richard. You are right, and now my layout works almost well.

 The remanent problem is that when making a cross reference of an "exemplo" it 
apears only a number, corresponding to the exemplo counter. Ex:

. . . As we seen in exemple 3

But I would like that the number of the chapter were also writen. Ex:

. . . As we seen in exemple 2.3
(3rd example of the second chapter).

Something lacks, but what?

Cheers
Ramon




Re: Cross-referencing a new environment

2007-02-16 Thread Richard Heck

This looks to be more a LaTeX issue than a layout issue. Instead of

\addtocounter{exemplo}{1}

use

\refstepcounter{exemplo}

The latter both steps the counter and makes it the target for
cross-references. Otherwise, the target remains whatever it was,
probably section, which is why you're seeing the "1".

Richard

Ramon Flores wrote:
> Hi:
>
> I have written a layout that is similar to book, but with a new environment, 
> called exemplo (example in English). 
>
> This environment has a "LabelType" of type "counter", and the counter works 
> nicely almost always, both in LyX screen as in output. I.e. each 
> new "exemplo" is numbered taking into account the previous "exemplos" and the 
> chapter.
>
> But it fails when making a cross-reference of one "exemplo". In this case the 
> exemplo counter is ignored, and the reference is always "1".
>
> Making layouts is not a easy thing, and after some days struggling with them 
> I 
> am exhausted. So I would be very grateful if somebody explain what goes wrong 
> with my environment. 
>
> Thanks
> Ramon
>
>
> The layout is the following
>
>
> 
> livro.layout
>
> #% Do not delete the line below; configure depends on this
> #  \DeclareLaTeXClass[book]{livro}
>
> Format 2
> Input stdclass.inc
> Input numreport.inc
>
> Sides   2
> PageStyle   Headings
>
> NoStyle Abstract
>
> Counter
> Nameexemplo
> Within   chapter
> End
>
> Style Exemplo
> Margin  First_Dynamic
> LatexType   Environment
> LatexName   exemplo
> LabelSepxx  
> ParIndent   MMM
> ParSkip indent
> ItemSep 0.2
> TopSep  0.5
> BottomSep   0.5
> ParSep  0.3
> Align   Block
> AlignPossible   block, left, center, right
> LabelType   Counter
> LabelCounterexemplo
> LabelString "Exemplo \arabic{chapter}.\arabic{exemplo}."
> LeftMargin  MM
> RightMargin MM
>
> Font
>  Family Sans
>  Shape  Upright
>  Series Medium
>  Size   Small
> EndFont
>
> LabelFont
>   FamilySans
>   Shape Upright
>   SeriesBold
>   Size  Small
> EndFont
>
> Preamble
>   \newcounter{exemplo}
>   \setcounter{exemplo}{0}
>   \newenvironment{exemplo}
>{
> \begin{list}{}
> {
> \setlength{\leftmargin}{5mm}
> \setlength{\rightmargin}{\leftmargin}
> \setlength{\parindent}{0mm}
> \upshape
> \sffamily
> \small
> }
> \item[]
> \addtocounter{exemplo}{1}
> \textbf{Exemplo \thechapter .\theexemplo} 
> }
> {
> \par
> \end{list}
> }
>   EndPreamble
> End
>
> Style Bibliography
> TopSep4
> LabelString   "Bibliography"
> LabelFont
>   Series  Bold
>   SizeHuge
> EndFont
> End
>   


-- 
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://bobjweil.com/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto



Cross-referencing a new environment

2007-02-16 Thread Ramon Flores
Hi:

I have written a layout that is similar to book, but with a new environment, 
called exemplo (example in English). 

This environment has a "LabelType" of type "counter", and the counter works 
nicely almost always, both in LyX screen as in output. I.e. each 
new "exemplo" is numbered taking into account the previous "exemplos" and the 
chapter.

But it fails when making a cross-reference of one "exemplo". In this case the 
exemplo counter is ignored, and the reference is always "1".

Making layouts is not a easy thing, and after some days struggling with them I 
am exhausted. So I would be very grateful if somebody explain what goes wrong 
with my environment. 

Thanks
Ramon


The layout is the following



livro.layout

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{livro}

Format 2
Input stdclass.inc
Input numreport.inc

Sides           2
PageStyle   Headings

NoStyle Abstract

Counter
Name                exemplo
Within               chapter
End

Style Exemplo
Margin  First_Dynamic
LatexType       Environment
LatexName   exemplo
LabelSep        xx  
ParIndent       MMM
ParSkip         indent
ItemSep         0.2
TopSep          0.5
BottomSep       0.5
ParSep          0.3
Align           Block
AlignPossible   block, left, center, right
LabelType       Counter
LabelCounter    exemplo
LabelString     "Exemplo \arabic{chapter}.\arabic{exemplo}."
LeftMargin      MM
RightMargin MM

Font
 Family Sans
 Shape  Upright
 Series Medium
 Size   Small
EndFont

LabelFont
  FamilySans
  Shape         Upright
  SeriesBold
  Size          Small
EndFont

Preamble
          \newcounter{exemplo}
  \setcounter{exemplo}{0}
  \newenvironment{exemplo}
       {
\begin{list}{}
                        {
                        \setlength{\leftmargin}{5mm}
                        \setlength{\rightmargin}{\leftmargin}
                        \setlength{\parindent}{0mm}
                        \upshape
\sffamily
\small
                        }
                \item[]
                \addtocounter{exemplo}{1}
                \textbf{Exemplo \thechapter .\theexemplo} 
                }
                {
                \par
                \end{list}
                }
  EndPreamble
End

Style Bibliography
TopSep                4
LabelString           "Bibliography"
LabelFont
  Series              Bold
  Size                Huge
EndFont
End