[texhax] Theorem numbering

hh-brasil at bol.com.br hh-brasil at bol.com.br
Tue Sep 14 14:06:30 CEST 2010


If I remember right, the counters start at zero as defined.
I might be necessary you have to find the introduction of your counter in your style file
and redefine it there. Even it should be possible to introduce a further counter or to change the counter's name, but this is not advised to newbies. 

\newcounter{thm}[section]

This defines that at each new section the counter thm will be set to 0.
hh





Em 14/09/2010 02:03, texhax-request at tug.org escreveu:
To subscribe or unsubscribe via the World Wide Web, visit
	http://tug.org/mailman/listinfo/texhax
or, via email, send a message with subject or body 'help' to
	texhax-request at tug.org

You can reach the person managing the list at
	texhax-owner at tug.org



   1. Re: Theorem numbering (Uwe Lueck)
   


----------------------------------------------------------------------

Message: 1
Date: Mon, 13 Sep 2010 21:57:11 +0200 (CEST)
From: Uwe Lueck 
To: switzel at mathematik.tu-darmstadt.de, Barbara Beeton 
Cc: texhax at tug.org
Subject: Re: [texhax] Theorem numbering
Message-ID: 
Content-Type: text/plain; charset=UTF-8

This may be one of the rather serious contributions of mine:

Barbara Beeton , 04.06.2010 15:34:59:
> stefan witzel asks for the ability to
> "re-use" a theorem with the same number
> as the original.
[...]
> re-using the theorem text is
> left as an exercise for the reader.

Actually doing the exercise:

I thought of the `extract' package (ctan.org/pkg/extract) or some 
`verbatimwrite' (ctan.org/pkg/moreverb, 
quite a few packages have similar functions)?difficult 
to learn?more easy instead (although not tested, sorry): 
Type theorem body code in an extra file, say, thm-outs.tex. 
To typeset the theorem at its "proper" place, type 
 
\begin{thm}\label{thm:outs} 
  \input{thm-outs} 
\end{thm} 
 
Barbara?s xrefthm is enlightening, 
yet I would prefer the following generalization 
(in the document preamble?once I desired to have this! 
e.g.: Thm. 2* an ?analogue? of Thm. 2 for a different setting): 
 
\newenvironment*{var-id-thm}[1]{% 
  \def\thethmid{#1}% 
  \begin{the-var-id-thm}% 
}{% 
  \end{the-var-id-thm}% 
} 
\newtheorem*{the-var-id-thm}{Theorem \thethmid} 
 
To be used like this: 
 
\begin{var-id-thm}{\ref{thm:outs}} 
  \input{thm-outs} 
\end{var-id-thm} 

I prepared the previous as HTML (looks finer) at

    http://www.webdesign-bu.de/uwe_lueck/texhax.htm#reuse-thm

(you may find an older version with some mistakes).

Cheers, 

    Uwe.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[OP:]
>    I'm using the amsthm-Package and number my theorem within sections, i.e.
>
>    \newtheorem{thm}{Theorem}[section]
>
>    Now I would like to quote a theorem from the end of the paper in the
>    introduction with its original number (which is 9.1 in my case).
>    Of course I could do so by manually setting the counters:
>
>    \setcounter{section}{9}
>    ₢0}
>    \begin{thm}
>    ...
>    \end{thm}
>    \setcounter{section}{1}
>    \setcounter{thm}{0}
>
>    but this destroys the idea of automatic numbering, because if my
>    theorem becomes Theorem 9.2 because it is preceded by Lemma 9.1, it
>    has the wrong number in the introduction.
>    When I once had the problem of quoting a theorem *after* it had been
>    stated, I used the following makros the save and recover the counters:
>
>    [...]
>
>    But how can I can obtain the number before the actual statement (using
>    the \label)? I imagine there should exist solutions to this, but I did
>    not find them on the web (and I don't know enough about
>    makro-programming, to extract the necessary information from the
>    \label-data myself). Many thanks in advance!
>
>the test file attached below uses \label
>to identify the theorem number, and also
>allows for multiple "re-used" theorem
>numbers.  re-using the theorem text is
>left as an exercise for the reader.
>						-- bb
>
>			--------------------
>
>\documentclass{article}
>\usepackage{amsthm}
>
>\newtheorem{thm}{Theorem}[section]
>\newenvironment{xrefthm}[1]{%
>  \def\thexref{\ref{#1}}
>  \begin{thexrefthm}
>}{%
>  \end{thexrefthm}
>}
>\newtheorem*{thexrefthm}{Theorem \thexref}
>
>\begin{document}
>
>\section{Introduction}
>In this section we have two theorems.
>
>\begin{thm}
>The first is an ordinary theorem.
>\end{thm}
>
>\begin{xrefthm}{laterthm}
>The other is a duplicate of a theorem in a later
>section, with its original number.
>\end{xrefthm}
>
>\section{Next}
>Here we have a different ``forward referenced'' theorem.
>
>\begin{xrefthm}{another}
>This theorem also has a number from a later section.
>\end{xrefthm}
>
>\setcounter{section}{8}
>\section{Ninth}
>
>In this section we have three theorems.
>
>\begin{thm}
>The first is an ordinary theorem.
>\end{thm}
>
>\begin{thm}\label{laterthm}
>But this one will be referenced earlier in the
>paper with the theorem number from here.
>\end{thm}
>
>\begin{thm}\label{another}
>And this one will also be referenced earlier
>with its own number.
>\end{thm}
>
>\end{document}
>_______________________________________________



------------------------------

Message: 2
Date: Mon, 13 Sep 2010 16:13:49 -0400
From: "Beuthe, Thomas" 
To: 
Subject: [texhax] Automated package option choice possible?
Message-ID: 
Content-Type: text/plain;charset=utf-8

UNRESTRICTED | ILLIMIT?

There are at least two packages that require option choices that depend on what program you are using to compile your LaTeX files:
color and hyperref.

Compile in pdflatex?  You need to use the pdftex option.
Using xelatex? You need to use xetex option, and so on.

Are there other packages that have similar requirements? (I'm curious)



My main question: Is there any way of automating the choice of options?

i.e.

if(packagebeingusedtorun=xelatex) then
  \usepackage[xetex]{color}

or something like that?

I know I could always centralize the choice to a single variable that gets set once,
but is there a way of getting away from setting this choice manually?

I'm guessing there is not since the packages themselves would have probably
done this already if it was possible, but I just wanted to throw this question out there...

Thomas
CONFIDENTIAL AND PRIVILEGED INFORMATION NOTICE

This e-mail, and any attachments, may contain information that
is confidential, subject to copyright, or exempt from disclosure.
Any unauthorized review, disclosure, retransmission, 
dissemination or other use of or reliance on this information 
may be unlawful and is strictly prohibited.  

AVIS D'INFORMATION CONFIDENTIELLE ET PRIVIL?GI?E

Le pr?sent courriel, et toute pi?ce jointe, peut contenir de 
l'information qui est confidentielle, r?gie par les droits 
d'auteur, ou interdite de divulgation. Tout examen, 
divulgation, retransmission, diffusion ou autres utilisations 
non autoris?es de l'information ou d?pendance non autoris?e 
envers celle-ci peut ?tre ill?gale et est strictement interdite.




------------------------------

Message: 3
Date: Mon, 13 Sep 2010 22:40:34 +0200 (CEST)
From: Uwe Lueck 
To: texhax at tug.org, "Beuthe, Thomas" 
Subject: Re: [texhax] Automated package option choice possible?
Message-ID: 
Content-Type: text/plain; charset=UTF-8

"Beuthe, Thomas" , 13.09.2010 22:13:49:
> There are at least two packages that require option choices 
> that depend on what program you are using to compile your LaTeX files:
> color and hyperref.
>
> Compile in pdflatex?  You need to use the pdftex option.
> Using xelatex? You need to use xetex option, and so on.
>
> Are there other packages that have similar requirements? (I'm curious)
>
> My main question: Is there any way of automating the choice of options?
> i.e.
> if(packagebeingusedtorun=xelatex) then
>   \usepackage[xetex]{color}
>or something like that?

Yes, it is, for a number of engines. The ones I know are `ifluatex', `ifpdf', `ifvtex', and `ifxetex': 

    http://ctan.org/pkg/ifluatex (etc.)

Cheers, 

    Uwe. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[OP:]
> I know I could always centralize the choice to a single variable that gets set once,
> but is there a way of getting away from setting this choice manually?
>
> I'm guessing there is not since the packages themselves would have probably
> done this already if it was possible, but I just wanted to throw this question out there...


------------------------------

Message: 4
Date: Mon, 13 Sep 2010 22:49:27 +0200
From: Heiko Oberdiek 
To: texhax at tug.org
Subject: Re: [texhax] Automated package option choice possible?
Message-ID: 
Content-Type: text/plain; charset=us-ascii

On Mon, Sep 13, 2010 at 04:13:49PM -0400, Beuthe, Thomas wrote:

> There are at least two packages that require option choices that depend on what program you are using to compile your LaTeX files:
> color and hyperref.
> 
> Compile in pdflatex?  You need to use the pdftex option.
> Using xelatex? You need to use xetex option, and so on.

No, both pdfTeX in PDF mode and XeTeX are autodetected
by hyperref and graphics.cfg/color.cfg (TL and other)

DVI driver options can't be autodetected, because the
DVI program is run *after* the TeX run is completed.

> Are there other packages that have similar requirements? (I'm curious)

Lots of packages are driver dependent.

> My main question: Is there any way of automating the choice of options?

The best you can achieve is:
* TeX processors like pdfTeX in PDF mode, XeTeX, VTeX, ...
  are autodetected.
* And a default is configured for DVI drivers.
  Or the DVI driver is given as global option.

> if(packagebeingusedtorun=xelatex) then
>   \usepackage[xetex]{color}
> 
> or something like that?

A package that provides autodetection and selection of drivers
would be useful, but a good design isn't too trivial.

Yours sincerely
  Heiko Oberdiek


------------------------------

Message: 5
Date: Mon, 13 Sep 2010 23:02:34 +0200 (CEST)
From: Uwe Lueck 
To: texhax at tug.org, "Beuthe, Thomas" ,
	vafakh84 at gmail.com
Subject: [texhax] FW: Re:  Automated package option choice possible?
Message-ID:
	
Content-Type: text/plain; charset=UTF-8

.... and indeed there is Vafa Khaligi's `iftex'. Vafa, you should include ifvtex and a command \texengine expanding to `pdf' `ifpdf' etc. -- Cheers, Uwe.

-----Urspr?ngliche Nachricht-----
Von: Uwe Lueck 
Gesendet: 13.09.2010 22:40:32
An: texhax at tug.org,"Beuthe, Thomas" 
Betreff: Re: [texhax] Automated package option choice possible?

"Beuthe, Thomas" , 13.09.2010 22:13:49:
> There are at least two packages that require option choices 
> that depend on what program you are using to compile your LaTeX files:
> color and hyperref.
>
> Compile in pdflatex?  You need to use the pdftex option.
> Using xelatex? You need to use xetex option, and so on.
>
> Are there other packages that have similar requirements? (I'm curious)
>
> My main question: Is there any way of automating the choice of options?
> i.e.
> if(packagebeingusedtorun=xelatex) then
>   \usepackage[xetex]{color}
>or something like that?

Yes, it is, for a number of engines. The ones I know are `ifluatex', `ifpdf', `ifvtex', and `ifxetex': 

    http://ctan.org/pkg/ifluatex (etc.)

Cheers, 

    Uwe. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[OP:]
> I know I could always centralize the choice to a single variable that gets set once,
> but is there a way of getting away from setting this choice manually?
>
> I'm guessing there is not since the packages themselves would have probably
> done this already if it was possible, but I just wanted to throw this question out there...



------------------------------

Message: 6
Date: Mon, 13 Sep 2010 23:41:16 +0200 (CEST)
From: Uwe Lueck 
To: texhax at tug.org, mb78aa at yahoo.com
Subject: Re: [texhax] Creating a source with macros embedded
Message-ID: 
Content-Type: text/plain; charset=UTF-8

"Mike B." , 30.07.2010 06:32:05:
> I use several files where I define abbreviations with \newcommand. I load these files at the preamble with
>     \input filea
>     \input fileb
> etc.
>
> Is it possible to transform a latex source file to have  all these macros embedded so I do not need to supply the abbreviations files?.
>
> For example, assume I define in filea
>     \newcommand{myabbr}{sometext}
>
> and my source code has
> blah blah \myabbr blah blah
>
> I would then obtain a new source code (with the macros replaced by their corresponding text)
> blah blah sometext blah blah
>
> so there is no need for to input the abbreviations files.

trying to reword: 
While abbreviating macros work as ?substitutions? at 
compiling only, Mike wants them to work as substitions 
on the source files. 
 
One might answer that Mike just had been impressed too much 
by TeX?s macro mechanism and chose abbreviating macros 
erroneously when he should have used a different program 
(not TeX) to perform that substitutions, ...

* such as AWK or Perl. But indeed there are scripts right for Mike?s purpose 
(see http://ctan.org/pkg/PKGNAME for package PKGNAME): 
 
* de-macro | detex | ltx2x. 

* Instead, you can use functionality of certain editors: 
user-defined editor commands (e.g., with Vim), 
?autocompletion?; ?expansion? 
(?auto-correction?, macros, variables, aliases; by shell ...) 
 
* If you are sufficiently mad, you may even choose TeX-based substitution: 
datatool | stringstrings  | ted | fifindo. 
The latter introduces a kind of script language 
(consisting of ordinary TeX macros) 
for performing multiple substitutions 
(still not very intuitive at present). 
 
* Back to ordinary use of macro files?for substitution! 
I am currently using an extension of my aforementioned 
fifinddo that ?copies? one file into another, 
however: expanding especially chosen macros 
(I am generating HTML this way for my own purposes??blog.sty?). 
This could be used here, but it would need \let\foo\relax  
for any standard LaTeX command that should not expand 
in this process (generating a source file). 
This may become useful if those source files don?t include 
the LaTeX document preamble, but rather are only (parts of) 
the body of the document environment. 

... previous made from 

    http://www.webdesign-bu.de/uwe_lueck/texhax.htm#mac-emb

Cheers, 

    Uwe.



------------------------------

Message: 7
Date: Tue, 14 Sep 2010 14:03:25 +0900
From: Torsten Wagner 
To: David Lumsden 
Cc: support at tug.org
Subject: Re: [texhax] Referencing help
Message-ID: 
Content-Type: text/plain; charset=ISO-8859-1

Hi,

just as an add-on to the two above answers.
Depending on your system and your latex editor, sometimes it might
happen the editor or get confused.
Some editors try to be smart. Clicking a button to generate a pdf will
start a program which trys to figure out which steps are necessary to
generate a pdf. To shorten compiling time as much as possible (pleasant
for the user normally), it might skip steps which seems to have no
changes compared to the last compiling.
As far as I remember this is even a part of latex itself for the
pdf-generation.

However, sometimes things went wrong and an old temporary file will
remain and not newly generated. At the beginning of my LaTeX journey I
spend some hours to search for non-existing errors until I figured out
that manual deletion of the temporary files solved the problem.

Some editors have a function to delete temporary files.
Basically (without warranty) you only need
*.tex your TeX-files
*.bbl your BibTeX style file which sit somewhere else in your TeX-Path
*.bib your BibTeX data file (if you use one at all)
and all files like templates (*.cls) etc. which you copied manually into
your project folder

all other files might be deleted. They will be generated by the next run
of latex -> bibtex -> latex -> latex

Hope that helps

Torsten

CC: A backup is always a good idea before deleting files in your project
folder




------------------------------

_______________________________________________
texhax mailing list
texhax at tug.org
http://tug.org/mailman/listinfo/texhax

End of texhax Digest, Vol 2010, Issue 347
*****************************************



More information about the texhax mailing list