{counters} is about macro writing involving counters. For general questions about numbering document elements, use {numbering}.
12
votes
2answers
223 views
How to refer to a chapter with a word
I would like to refer to my chapters with the notation "First Chapter", "Second Chapter" etc, rather than "Chapter 1", "Chapter 2", etc. How can I do this?
\documentclass{scrreprt}
...
10
votes
3answers
587 views
How can I calculate the difference of 2 counters (pageref)?
How can I calculate the difference between 2 counters (like page numbers), so that pdfLateX outputs "3" in the last line of my example?
and how could I calculate the difference between the "current" ...
15
votes
2answers
250 views
A new kind of “symbol wrapping”
alphalph defines three methods for continuing a set of symbols if you hit the end.
alph continues like so: a,b,c…z,aa,ab,ac…
mult continues like so: a,b,c…z,aa,bb,cc…
wrap continues like so: ...
9
votes
2answers
408 views
Combine two items in an enumerated list
Is there an easy way to combine two items in an enumerated list? For example:
1. First bullet
2-3. Second bullet
4. Third bullet
My current plan involves screwing with \labelenumi and then ...
6
votes
2answers
127 views
Setting a counter for sections
I prepare a document where there are questions as follows and the relevant content
\section*{Question 1}
...
\section*{Question 2}
...
\section*{Question 3}
...
...
I want a counter instead of ...
6
votes
1answer
221 views
How can I reset sectional counters in memoir class to avoid breaking ToC cross-referencing in a complex document?
I have already asked a similar question here:
Incorrect ToC/Index cross-references when resetting memoir class counters
and received a satisfactory answer. Now, I wish to apply the chapter counter ...
6
votes
4answers
593 views
How do I make a counter start with 1?
I defined a counter like this:
\newcounter{my_steps}[subsubsection]
and I would like to make it start with 1 instead of 0 after each subsubsection. How?
1
vote
1answer
197 views
Defining repeated tabular/array columns using a computed value to specify the number
Background:
I just recently saw that one could define multiple columns in a tabular or array using the syntax:
*{num}{<align>}
So, for example \begin{tabular}{r*{3}{l}r} is the identical to ...
3
votes
2answers
370 views
mdframed and ntheorem counters
In the code below, counters defined by mdframed seem to not be accessible to ntheorem environments which is problematic but ntheorem counters can be read by mdframed. I could not find a work around ...
5
votes
3answers
240 views
Odd interaction of secnumdepth and section-based counters
In the following MWE:
\documentclass{book}
\newcounter{exnum}[subsection]
\begin{document}
\chapter*{Chapter}
\section*{Section 1}
\subsection{Subsection A}
\setcounter{exnum}{1}
...
16
votes
1answer
674 views
What are the differences between TeX counts and LaTeX counters?
The title already states the whole question. It has been answered by Joseph Wright at http://www.texdev.net/2009/11/17/tex-counts-and-latex-counters/, but I have not seen the according answer here at ...
19
votes
3answers
638 views
How to display the final value of a counter at the beginning of a document?
At the beginning of my document, I have created a counter using \newcounter. Over the course of the document, this counter is increases using \stepcounter. How can I display the final value of the ...
8
votes
4answers
242 views
Slave duplicate counter
Is it possible to create a counter that is a "slave" to another (master) counter, but also an exact duplicate?
The \@addtoreset{<slave>}{<master>} resets <slave> whenever ...
1
vote
1answer
286 views
How to create a new counter for an a new environment that is in sync with subsections
I want to create an example environment with a counter which will be in sync with my subsections. So I'll have:
subsection 3.2
lemma 3.2
example 3.2
example 3.3
lemma 3.3
subsection ...
2
votes
1answer
277 views
Should this combination of counters and \ifnum conditions work or does it need modification? Is there a better way?
I'm producing the final product of my thesis with LaTeX. I'm having trouble with the front matter of my thesis, specifically with getting LaTeX to recognize that if the front matter stops at a certain ...
3
votes
3answers
745 views
Table of Contents numbering in decimals?
I have created my first LaTeX document, its very small and have 4 sections. The problem is the numbering is in decimals and looks a little odd, I have searched every where, I'm sure its a simple fix.
...
5
votes
1answer
346 views
Incorrect ToC/Index cross-references when resetting memoir class counters
The quasi-MWE below uses the memoir class and works fine. It produces a document with the following structure:
ToC
Book
Part1
Chapter1
Part2
Chapter2
Index
Here, cross-references in the ToC and ...
11
votes
2answers
311 views
Middle age roman numerals formatting
I've recently read about a middle age variation on roman numerals where the last "i" character is replaced by a "j". I was thinking about writing my own \roman and \Roman variations, but hit a stone ...
0
votes
1answer
198 views
Counting letters inside paragraph
I am trying to make a new command \part which is defined such that each time I type
\part the output equals
\paragraph*(letter)
where letter is bold. So, with typing the letter manualy in, the ...
2
votes
2answers
95 views
Cross-referencing to the number of a customized environment with a counter
On the internet I found a possibility to create an example environment that is helpful for linguistic research papers, because it provides all examples with numbers:
\newcounter{exa}
...
4
votes
2answers
304 views
Numbering theorems within the innermost sectioning environment present at that point in the document?
Here is what I am trying to achieve:
Chapter 1.
...
Theorem 1.1.
...
Section 1.1.
...
Theorem 1.1.1.
...
Subsection 1.1.1.
...
Theorem 1.1.1.1.
Is this even possible? If so, how?
...
2
votes
1answer
220 views
New sectioning level above section
I would like to create a newcounter (lectcount) which will be one level above the "section" in article class, and use its name in the headings (I am using fancyhdr).
I don't know how to set the ...
21
votes
5answers
2k views
How to output a counter with leading zeros?
I can output the value of a counter in a LaTeX document via:
\setcounter{mycounter}{1}
\arabic{mycounter}
Which inserts a 1. But how do I format the output by, for example, adding a leading zero if ...
1
vote
1answer
307 views
Refering to the same (alphabetically “numbered”) footnote more than once
Following my previous post concerning the change of numbering in footnote to temporally be alphabetical, I'm trying to merge this with the possibility to refer various time to the same footnote as ...
9
votes
3answers
3k views
Change footnote “numbering” temporarily
I would like to change my footnote "numbering" style temporally to letters (a,b,c ...) the default numbering beeing numbers (1,2,3 ...).
This is needed only for specific paragraph, so I can't use the ...
2
votes
2answers
299 views
Increment custom counter with standard sectioning command?
My document is a (scr)book and I'm talking of parts and chapters here, but I think the underlying question is pretty generic.
I want tables in the book to be enumerated continuously, in a ...
6
votes
1answer
241 views
Determine number of lines in a verbatim environment
I'm trying to implement two new key-value pairs for the fancyvrb package:
head= and tail= specify how many lines to display: That is, head=10, tail=5 specifies to print the first 10 lines of the ...
7
votes
6answers
549 views
How to split an example into two parts?
I am trying to have an example (using the theorem environent in amsmath) split in two parts:
Example 1 ...
Some more discussion
Example 1 (continued) ...
What is the best way to do this ?
The ...
2
votes
1answer
231 views
Changing \@itemdepth value to control indentation
I would like to be able to control the nesting level of an item (so that I can align the text with text that is at a deeper level of nesting.) I have been able to read the value of \@itemdepth ...
4
votes
1answer
3k views
Changing number within \numberwithin causes malfunction but no compile error
An interesting one here. It could be a bug or I might be missing a trick. In my thesis I use \numberwithin{}{} to have numbering done within sections. Top level is chapter, so it goes ...
3
votes
1answer
216 views
Command to find current enum depth?
I was wondering if there was a command to find what at what depth of the enum counter (i.e. enumi, enumii, etc.) a command was at compile time. I'm attempting to create a \question command. What I ...
9
votes
3answers
872 views
Number exercises according to chapter
I'm using the exercise package together with memoir class. How do I number my exercises according to chapter number, in the same way that display equations are numbered? Here's a minimal example
...
2
votes
1answer
189 views
Hyperref problem with enumerated tabularx rows
I was trying to do an enumeration with columns, which references one item from another one in the same list. I figured out that the best way is to make a table with enumerated rows. I had a working ...
3
votes
3answers
237 views
Show “Page X of Y” only if there are multiple pages?
I'm trying to add a line in the header to be "Page X of Y", but only if there are multiple pages. My main problem is how to format the if statement. So far I have
\ifx \pageref{LastPage} 1
...
1
vote
1answer
446 views
How to avoid beamer counter incrementing
In Latex beamer, I've created a handout environment for slides that are for the produced handout only (ie. not to be shown on the viewer). It looks like this:
\newenvironment{handout}[2][1]{
...
10
votes
1answer
547 views
Why do \setcounter and \addtocounter commands have global effect, while \setlength and \addtolength commands obey the normal scoping rules?
The \setcounter and \addtocounter commands have global effect,
while the \setlength and \addtolength commands obey the normal
scoping rules.
Why were they designed like this? Why are ...
3
votes
2answers
1k views
How to get autoref working with different counters for different listing environments?
In my document I want several different custom listing environments. The solution from fraktalek works like a charm, except for one thing: \autoref doesn't work for me. I have tried the following:
...
8
votes
3answers
2k views
Resetting theorem counters: \section and (missing) \subsection
Suppose I define a new theorem "Theorem" and declare that its counter should be reset whenever the subsection counter is incremented or reset:
\newtheorem{theorem}{Theorem}[subsection]
At some ...
3
votes
2answers
927 views
Resetting newtheorem counter
This one is probably straightforward, but I'm not missing something with the newtheorem environment and using newcounter. I would like a new environment on its own counter like "Environment M.1", but ...
1
vote
2answers
397 views
Extract document statistics? - How many pages has chapter xy? Count fixmes?
I have a large pdflatex document where each chapter is located in an extra text file and included with \include{chapter3.tex} ...
How can I extract the page numbers of each chapter and write them ...
3
votes
1answer
423 views
Why does hyperref bookmark work?
The \appendix command resets the section counter to zero:
*\documentclass{article}
*\show\appendix
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h ...
8
votes
2answers
244 views
French chapter numbers
This question led to a new feature in a package:
impnattypo
French typography recommends that chapters be numbered in uppercase roman numbers, except for chapter 1 which should be called ...
17
votes
3answers
480 views
Should LaTeX counters always be modified globally?
In this answer, egreg states that "LaTeX counters should always be modified globally". However, the etoolbox package provides the \defcounter macro which will assign a value to a previously ...
4
votes
1answer
203 views
Length needs backslash but counter does not, why?
\documentclass{minimal}
\parindent=0sp
\newlength{\Length}
\setlength{\Length}{1in}
\newcounter{Count}
\setcounter{Count}{10}
\begin{document}
\the\Length
\theCount
\end{document}
Length needs ...
3
votes
1answer
222 views
How to get a customized counter
I would like to change my equation counter for a specific chapter to a customized one, for example: EQ.1, EQ.2, EQ.3.
Does anyone know how to do it?
4
votes
3answers
297 views
Programmatically setting a counter to a substring
I'm trying to set a counter based on the name of the current job. I've got the number I need by doing something like \substring{\jobname}{5}{5}} using the stringstrings package, and if I just output ...
1
vote
1answer
201 views
Problems using \def commands inside an environment
In trying to build the commands \sol and \solutions to use them inside the exercises environment. The commands must work in this way:
\begin{exercises}
\exer text for exercise 1\sol{solutionA}
...
0
votes
0answers
240 views
Error with \setcounter [closed]
please look at this:
\setcounter
{MaxMatrixCols}{10} \setlength{\textheight}{20 true cm}
! LaTeX Error: Option clash for package geometry.
i am using a custom class, it ...
18
votes
2answers
370 views
What is the proper method of accessing a counter?
It seems that there are different ways of accessing counters. I have been using \theMyCount as in this post about Using counters or macros, but noticed that the arrayjobx package uses ...
5
votes
4answers
2k views
custom counter and cross-referencing
I created a custom counter 'rtaskno' and a command '\rtask' as following:
\newcounter{rtaskno}
\newcommand{\rtask}{%
\stepcounter{rtaskno}%
\thertaskno}
I like to use them as following:
...