{counters} is about macro writing involving counters. For general questions about numbering document elements, use {numbering}.

learn more… | top users | synonyms

3
votes
1answer
88 views

How should I handle a counter where the numbers do not have a pattern?

I am working on homework and problems are assigned from several sections of a book. For example, I have to solve problems 1, 7, 24 from section 1 and problems 2, 5, 9 from section 2. I do not care ...
4
votes
2answers
62 views

loop in tabular that uses \the\count to access current line number

I would like to generate an autmatic table using loop. As suggested here before, it is best to first generate the lines in a toks and then pass them to tabular. However, I have problems with accessing ...
2
votes
1answer
41 views

How to adjust the section numbering (as in skipping a couple of section numbers) when using letters instead of numerals for section numbering?

I have changed the section numbering from numerals to letters with the command \renewcommand{\thesection}{\alph{section})} in the preamble. For example, the first \section{} would be printed like ...
2
votes
1answer
32 views

Create a copy of the subsections counter

I'm writing a mathematics paper with \documentclass{amsart}, and I would like my theorems, definitions, propositions, etc., to be numbered "like subsections", i.e., if a given theorem is the fourth in ...
3
votes
2answers
38 views

Revisions of a theorem where numbering goes 2.0, 2.1,2.2

I would like to give different equivalent versions of the same theorem, eventually proving the last version. The first time I state the theorem, I would like it to have the number 2.0. Each successive ...
1
vote
1answer
27 views

Starting the \parts environment with a different counter in exam class

I need to be able to start a parts environment at a later counter. For instance, starting with part (b) instead of (a). \documentclass{exam} \begin{document} \begin{parts} \part this is part a. ...
4
votes
2answers
45 views

Reset counter automatically after lstlinputlisting or lstlsting

I have a number of code examples annotated with a number set by a counter, lstNoteCounter and referred to in the text below the code: My markup works, but it isn't convenient for a large document: ...
6
votes
4answers
110 views

Create row tables like for cycle from counter

I have a counter and I want to create a table with as many rows as the counter automatically. Each row should be numbered. Thanks
1
vote
1answer
34 views

Chapter counting set up

I want chapter numbering like: Chapter 1, Chapter 2, Chapter 3, Appendix A, Appendix B. But I am getting like: Chapter 1, Chapter 2, Chapter 3, Appendix D, Appendix E. When appendix chapters are ...
5
votes
1answer
97 views

What's the meaning of the command \number and when to use it? And some confusion about the following code

\setcounter{numofgaps}{\numexpr\number\value{numofboxes}-1} \setlength{\truetextsectionwidth}{\textsectionwidth-\number\value{numofgaps}\gapwidth} The above code is a snippet from the answer of How ...
5
votes
2answers
153 views

Number of Equation: 1, 1a, 1b

Following Problem: I have a PDE and two boundary conditions what i actually want is: PDE (1) BC1 (1a) BC2 (1b) and what i have is: PDE (1) BC1 (2a) BC2 (2b) is there something which provides a ...
4
votes
1answer
42 views

Definition with roman counter value

Is it possible to write a definition with a counter value? I have many definitions with a Roman numeral: \def\abcI{} .. \def\abcII{} .. \def\abcIII{} .. But this is not possible: ...
4
votes
1answer
39 views

I want to reset the question numbering under each section?

I am using exsheets to type questions and answers. When I start a new section, the question number continues from the previous one. How do I reset it it and make it start from number 1 again? Here is ...
1
vote
1answer
95 views

Calculating with different types of variables

Is there any way to calculate the height of a node in a tikz pictures and to divide a length by an another length to get a counter and to round it up? If yes where could i read after the subject of ...
5
votes
2answers
104 views

\stepcounter is not working in subsection heading

I have defined a new counter as: \newcounter{lecCounter} \newcommand{\lecID}{\stepcounter{lecCounter}\thelecCounter} And I wish to use it as: \subsection{Lecture \lecID } But it gives error: ! ...
0
votes
0answers
30 views

Beamer Counter Command [duplicate]

I am wanting to number questions in a Beamer presentation. I created the following counter command: \newcommand{\qcount}{\arabic{QCount}: \addtocounter{QCount}{1}} I have a \pause command on a ...
3
votes
1answer
36 views

running number/counter (e.g. {244}{a}) for a text

To assign a running counter to parts (not paragraphs, not lines) of a document with facing greek text and translation (finally I will use eledpar) I need a command (call it \Steph) which 1a) inserts a ...
3
votes
1answer
96 views

Converting strings to counts

I'm reading in a number (as text) from the aux file and I want to do a numerical test (\ifnum) on it. I can to it using \setcounter and \value, but I really don't want to create a counter just to do ...
2
votes
1answer
78 views

amsmath align* tampering with a counter of mine

\documentclass[a4paper]{report} \usepackage{amsmath,mathtools} \makeatletter \newcount\mw@shortcnt \mw@shortcnt=0 \newcommand{\short}[1]{% \global\advance\mw@shortcnt by +1% ...
2
votes
1answer
27 views

Set theorem counter to be Roman

I wanted to make the counter for a theorem displayed as capital roman numerals (I, II, III), but none of these attempts worked \newtheorem{test}[\Roman{counter}]{Theorem} ...
12
votes
2answers
275 views

How can I get latex to show an error message if there are too many pages?

I have a series of pdf files that I'm combining. I'd like to include as many of them as possible in the finished document, but for logistical reasons I cannot have a total of more than 50 pages. Is ...
2
votes
2answers
33 views

Numbering tables sequentially [duplicate]

I would like to number my table so that I have, e.g. Theorem 1.3 Table 1.4 Lemma 1.5 How can I achieve this result? I am also using cleveref, so ideally \cref{ThatTable} would produce a linked ...
3
votes
1answer
45 views

Manually setting chapter counter overrides TOC

I have parts for each year: \part{2011} ... \part{2012} ... etc. ... I want the chapter number to be the month of that year for stylistic purposes (e.g. like how the chapter number is shown here) ...
3
votes
1answer
52 views

Setting the enumi counter under custom enumeration with enumitem

I have a several items in an 'enumitem' enumerate environment with custom label styles, and I would like to repeat them at various points later on. Something like this: (a) Unicorns don't exist. ...
4
votes
1answer
63 views

Change a letter in the alphabet in alphabetic counter

Using an alphabetical counter in arabic by the command \alph, it gives for the first letter of alphabet the arabic letter ا which is not so "beautiful" to use... I want to use the letter أ instead of ...
0
votes
1answer
38 views

Expand second argument/counter

I'm currently working on a somewhat automatic way to generate B+ trees. Thus I introduced a new macro to generate the content of a matrix of nodes which should also generate the labels automatically. ...
1
vote
1answer
21 views

Adding a new crossref type for a user-defined environment

In short, I'm trying to define an environment comment which has its own crossref type and counter. I want to be able to refer to these comment environments later. Looks like cleveref does what I ...
0
votes
1answer
21 views

Continue counting for footnotes in a sideways-table

I'd like my sideways-table footnotes to continue the counting of the normal footnotes. At the moment the footnotes in my sideways-table restart counting. Here's what I've got: \documentclass[11pt, ...
5
votes
2answers
82 views

arrays of counters for tikz nodenumbers?

Answering How to highlight portions of a matrix is a nice technique that isn't invasive, but requires manually numbering the nodes. I'd generalized it slightly: \documentclass{article} ...
0
votes
0answers
24 views

How to expand the countername before calling \newconter or \addtocounter

I need to do the following \newcounter{problem\theenumi} Clearly, enumi changes with time, but the counter name must be fixed NOW! So, for example, even after \end{enumerate} I should have access ...
4
votes
1answer
78 views

Subequations, tags and numbering

I have a problem with the following code. \begin{subequations} \begin{empheq}{align} & a = b \label{E1} \\ & c = d \label{E2} \end{empheq} \end{subequations} \begin{subequations} ...
6
votes
1answer
151 views

Correct usage of the LaTeX \newcounter and associated commands?

Previously I had a question about the \newcount command. I was then led to consider the \newcounter command instead, that does allow the use of digits in counter names. Accordingly, I have modified ...
2
votes
1answer
58 views

Workaround that allows the use of digits as part of counter names?

I tried to define indexed counters, such as x1, x2, . . . etc, by defining them like this : \newcount\x1, \newcount\x2, . . . etc, but it didn't work. Is there a workaround for this in TeX or LaTeX ? ...
4
votes
1answer
48 views

How do I disable the theorem counter for \autoref when using an extended theorem name?

I’m writing a paper, and I need to quote a theorem by a mathematician whom we’ll call Genius. This theorem already goes by a well-known name, say Genius’ Special Theorem. I’d like to cite this theorem ...
6
votes
3answers
338 views

How to make the asterisk a part of a counter?

I am writing a usual article in amsart style using amsthm package to number the theorems. I need to enumerate certain conditions, while two of them have to bear the same number differing only with an ...
1
vote
0answers
34 views

macro for glossaries counter

I want custom my glossaries, and specially I want to have something like My glossary entry, its signification (see p. 1), if this entry mentioned only once or My glossary entry, its signification ...
5
votes
1answer
176 views

Print counter value minus 1

I have defined a new counter that keeps increasing each time I call the macro that's using it. How can I print the counter value minus one? Something like \value{\theCounter-1} but formatted for text? ...
3
votes
1answer
37 views

Cross-referencing to included PDF with counter and argument in the label

I would like to use the following code for including PDF documents in my LaTeX document: \documentclass[12pt,a4paper,fleqn,parskip=half]{scrartcl} \usepackage{lscape} \usepackage[latin1]{inputenc} ...
4
votes
2answers
56 views

customised Symbol-list for Numberstyles other than arabic/roman/alpha, etc

When using \enumerate one can enter \begin{enumerate}[(a)] and each item will be numbered (a), (b), (c), (d), \ldots. Similarly for \begin{enumerate}[i)] — one gets i), ii), iii), iv), etc. I am ...
5
votes
1answer
131 views

Reset equation numbering after each section

I would like to reset equation numbering after each section or subsection. Right now I use \setcounter{equation}{0} I saw in another page you could also reset it by adding the following line to the ...
3
votes
1answer
22 views

\stepcounter does not work in \item optional argument

I need a simple enumerate list with a custom label but I can't use the enumitem package. \documentclass{article} \newcounter{mycounter} \setcounter{mycounter}{1} ...
4
votes
1answer
72 views

Enumerating tabular data

How do you enumerate tabular data like this? a) stuff stuff stuff b) stuff stuff stuff c) stuff stuff stuff I considered making a table then using a counter: ...
1
vote
1answer
51 views

Removing the step numbering from cuisine package

I would like to remove the step number from the cuisine package. That is the 1 that appears in the left side of the ingredients in the following code: \documentclass[]{article} ...
4
votes
1answer
40 views

Defining xkeyval keys within a loop

I have a project for which I make extensive use of the great xkeyval package. However, I'm still struggling with some more extravagant things. For example, I want to use enumerated keys (key1 to keyN, ...
0
votes
1answer
41 views

Want page numbers to increase by 2 instead of 1

Does anybody know of a way to change the page number counter so that it increases by 2 instead of 1? I tried writing \newcommand{\anewpage}{\newpage} ...
2
votes
1answer
31 views

array: incrementing in an array with a prescribed rule

From an earlier post, tabular environment: incrementing the headings, I learned some of the basics of incrementing a counter in an array. However, I don't know enough yet to set up a counter for the ...
5
votes
2answers
87 views

Defining special counter

Theorem counters can be set to zero automatically on changes of chapter, section, or subsecion, by the second optional argument of \newtheorem (e.g. \newtheorem{foo}{Foo}[section] produces a theorem ...
2
votes
2answers
134 views

Number of row in a tabular

Is there a simple way to get the number of rows of a given tabular ? More precisely, I have a variable \t@b which contains something like foo & bar \\ foo & bar \\ foo & bar I will ...
3
votes
2answers
25 views

References for asparenum enviroment with counters dependable from section

guys! I'm writing math lectures using my own enviroment for definitions: \newenvironment{mydefs} {\begin{asparaenum}[\P\slshape\thesection.a]} {\end{asparaenum}} So every definition is numbered ...
5
votes
1answer
55 views

How do I feed evaluated references into this sorting routine?

Below is some code I cobbled together from examples found on the net. I would like the sorted list routine to use the results of evaluating \ref rather than using the literal argument of \ref. ...