{counters} is about macro writing involving counters. For general questions about numbering document elements, use {numbering}.
4
votes
1answer
128 views
How to count the number of authors of a document?
I need to make a change to a Latex style (.sty) which contains the following line:
{\large {\boldCondensed\color{corporate3Color}\raggedright AUTHORS: \MakeUppercase \@author\par}}
The problem is ...
2
votes
3answers
138 views
Process Last Item in \ForEach (forarray package)
The following command of the forarray package
\ForEach{,}{\thislevelitem(\the\thislevelcount) : }}{x,y,z}
produces the output
x(1) : y(2) : z(3) :
I want to have the same output without the last ...
4
votes
2answers
3k views
\setcounter{tocdepth}
Using \setcounter{tocdepth}{0} displays just the chapter's title in the table of contents. In the last chapter, there's a subsection. I want to use \setcounter{tocdepth}{0}! Therefore no subsection ...
4
votes
1answer
1k views
Redefining a theorem counter
I have a document with a lot of lemmas and theorems. In the main part of the document there are sections and subsections, so I defined
\newtheorem{lem}{Lemma}[subsection]
to number the lemmas ...
6
votes
1answer
179 views
Checking if is Appendix or Chapter
How can i check if the value in \thechapter or \value{chapter} is a letter or a number?
That way i could identify if the counter is referring to a normal Chapter or an Appendix.
12
votes
1answer
185 views
How to erase/delete a counter
I was wondering how does TeX manage counters. In particular, assuming I define a new counter in TeX by \newcount\mycounter and at some point I don't need it anymore, can I delete it and free the ...
7
votes
1answer
199 views
Macro vs counter: How to store and operate with numbers in TeX without using (too many) counters
I need to store and use a large amount of integers (a little bit of "programming with TeX"), but I know that TeX has a limited (up to 256) number of counters that can be used simultaneously. How to ...
6
votes
2answers
505 views
Count number of figures, tables and citations in report class
I'm using report documentclass and trying to use totcount for counting figures, tables and references, but there are two problems:
Figures and tables counters are reset for each chapter, so ...
2
votes
1answer
84 views
Where to find a list of all system-defined counters in ConTeXt?
I learned from How to obtain the current page number in ConTeXt? that I can obtain the page number counter value using tex.count.pageno, but I have not found this mentioned in any available ...
7
votes
1answer
362 views
Accessing the current overlay number in beamer
For some beamer related code in one of my packages I need to access the current overlay number. I mean the internal number used for things like \only<1>{..}.
\only<1>{ Some internal ...
3
votes
2answers
3k views
How to reset chapter and section counter with \part
To get the output Toc or pdf bookmark below:
Part I
Chapter I
Chapter II
Part II
Chapter I
Chapter II
I need to reset the chapter counter. I google and get one method.
...
1
vote
2answers
135 views
How to make additional paragraph commands that use sectioning counters?
I would like to be able to use the following additional (new) commands: \sparagraph, \ssparagraph, \sssparagraph. All of these will use the \paragraph formatting but, will use different counters. The ...
5
votes
1answer
106 views
Print the counter given as an argument
I have a counterA and a counterB. I want to define a command \PrintCounter, which gets either A or B as argument, and then prints the value of the corresponding counter.
I wrote the following code:
...
4
votes
3answers
283 views
Using \total of totcount package in section title
I am keeping track of all the journal papers I review, and of course I'm using LaTeX.
There are different journals I review for and I have different tables and counters keeping track of papers. Each ...
5
votes
3answers
439 views
Automated lists for todos in Latex document
When I write a document in Latex I usually use my custom \todo{<my note>}-command to not forget things that I will have to come back to. Something like
...
14
votes
2answers
1k views
Error: Counter too large! with \alph{cntr} and cntr>26
I would like to have \alph{counter} for values larger than 26. The following MnWE gives me the error ! LaTeX Error: Counter too large.
\documentclass{article}
\begin{document}
\begin{enumerate}
...
10
votes
3answers
821 views
How to save variables
I need to change 'hyphenpenalty' in some parts of my document, but I have no idea how to properly restore a previous value after that.
For example:
\hyphenpenalty=10000%
\@starttoc{toc}%
...
9
votes
2answers
416 views
“Arithmetic overflow” error
factorials up to 12 are handled.How can make it to compute beyond that?
Error: “Arithmetic overflow
\documentclass{article}
\begin{document}
\newcount\n \newcount\p \newcount\m
...
2
votes
1answer
176 views
How to compare two counters using TeX conditionals in ConTeXt?
I have two counters, \definenumber[words] and \definenumber[items]. I have tried to use TeX conditionals to compare them, e.g.:
\ifnum\getnumber[words]=\getnumber[items]
This will print some text ...
3
votes
1answer
247 views
Using counter values as part of style name for plots
I figured I should be able to give a bunch of line styles and access them using counters. Sure enough, this works out fine; this document
\documentclass{article}
\usepackage{tikz,pgfplots}
...
7
votes
1answer
141 views
Printing character number i
I have a counter 1 ≤ i ≤ 26 and I want to print a character between a and z depending on value of i. How can I do this in LaTeX?
5
votes
1answer
211 views
Modifying \answerline in the exam class
When using the exam class, is there a way to change the formatting of the item answer blanks created by \answerline?
For a question, the label is 1.
For a part, the label is (a)
For a subpart, the ...
2
votes
2answers
324 views
TikZ: Automatic Numbering of Nodes, \value{counterName}
\documentclass{standalone}
\usepackage{tikz}
\newcounter{xi}
\setcounter{xi}{0}
\newcommand{\foo}[0]{
\addtocounter{xi}{1};
\coordinate (x{\value{xi}}) at (1,2);
}
\begin{document}
...
3
votes
1answer
477 views
Don't skip framenumbers in beamer in handout mode
Consider the following beamer example below. Is it possible to adjust this, that Frame 4 has framenumber 3 on the handout (and not 4 in my example). In other words the numbering in the handout should ...
9
votes
2answers
552 views
print word count
The journal I am submitting to requires a count of the words on the title page. I can of course run texcount on the .tex document and put the number in, but it seems that I should be able to automate ...
0
votes
0answers
40 views
How to unbind counter from its master? [duplicate]
Possible Duplicate:
What is the proper method of accessing a counter?
Continuous v. per-chapter/section numbering of figures, tables, and other document elements
I'm using the book class, ...
4
votes
1answer
455 views
Saving and re-using value of a footnote counter twice - how?
I am trying to put the same footnote on to two different places - saving and re-using the footnote counter. Here is what I want to do (part of a larger doc - a paper out of my dissertation):
%Start ...
10
votes
2answers
158 views
Counting the total number of theorems
I have:
\usepackage{amsthm}
\newtheorem{problem}{Problem}
....
\begin{problem}...\end{problem}...
...
\begin{problem}...\end{problem}...
In the first page of the document, how can I know the number ...
3
votes
1answer
115 views
How can I create copies of a document with a running number?
I am making a questionnaire, to be filled out with pen and paper. I need 40 copies of it, with around 13 pages each. I expect that some participants might take the questionnaire apart, so I have to be ...
3
votes
2answers
212 views
Re-displaying section headings after page-breaks
I'd like to automatically repeat section headings after a page break. My naive attempt at doing this is to check the page counter and print the extra text whenever the counter increments:
...
3
votes
1answer
371 views
usage of \only with counter, pdfcomment and beamer class
I cannot manage to get the following command to work. I have a beamer presentation with several slides on a frame. Then I want to use the pdfcomment package to show some comments on the slides. ...
14
votes
3answers
207 views
How to determine which register a count uses
Suppose there is
\newcount\c@mycountera
\newcount\c@mycounterb
\newcount\c@mycounterc
Each \newcount uses \alloc@ and that has \wlog{\string#5=\string#2\the\allocationnumber}. Thus to determine ...
5
votes
1answer
160 views
Is it possible to remove length, counter, dim, etc that have been declared?
Let's see the following screenshot taken from an answer of Efficient ways to anonymize a document and the given comment.
Is it possible to remove length, counter, dim, etc, that have been declared ...
3
votes
1answer
780 views
Chngcntr: \counterwithout not working
I need to place the tables section after my appendix. I've used \counterwithin{table}{section} to number appendix tables A.1, A.2, etc. Then I use \counterwithout{table}{section} so that the tables ...
6
votes
1answer
329 views
Trouble with hyperref when resetting the counter for equations (specifically with the align environment)
I am trying to reset a counter to zero; however hyperref tries to reference previous equations. I am using:
\setcounter{equation}{0}
And if I have labels in say align environments:
...
15
votes
3answers
301 views
Extracting the “parent” counter of a sectional unit
I am interested in finding the "parent" counter of a specific sectional unit. For example, in the following document structure
1. A section
1.1 A subsection
1.1.1 A subsubsection
1.1.2 A ...
1
vote
1answer
177 views
Display counters only if it is used at least two times
In this page, I've found one way to display one counter only if it is used at least two times.
The problem with this solution is that it doesn't work with two counters. Is there a way to allow this ...
3
votes
1answer
141 views
Figure refs stop working after I added a new counter
I was using the amspset document class for generating exam practice problems. I had wanted to add some referencing to the problems so I started a new counter like this (adapted from some Tex Exchange ...
10
votes
4answers
248 views
Counting of selected words
I am typesetting a book, which has got more number of plants. While entering the text, I have to record the total number of plants recorded in my book.
In fact, I have created an index of all these ...
6
votes
1answer
698 views
Revert (reverse) \numberwithin effect
How can I revert the action of \numberwithin{mycounter}{section} so that mycounter does not reset with a new section?
Example: (This is not exactly my case but this is easy to understand.) I would ...
3
votes
4answers
435 views
Problem with a counter inside a \ul command
The following MWE gives a compilation error. If i move the \arabic{count} outside from the \ul command, it works
\documentclass{article}
\usepackage{soul}
\begin{document}
\newcounter{count}%
...
2
votes
1answer
218 views
Problems with counters and frame splitting commands and environments in beamer
Using the package gb4e for linguists in the beamer environment in combination with frame splitting commands \pause or environments overprint, I face the following problem: The number are "jumping" ...
6
votes
2answers
712 views
Save current value of counter in a command
I would like to define kind of an own index, that collects certain information and one counter value - in the following small example the \addstuff-command that may get the value of a counter as its ...
9
votes
2answers
553 views
Integer arithmetic in TeX
After many years of being merely a regular TeX (LaTeX lately) I started reading little bit more recently. I wrote a small program (very naive) which is suppose to illustrate doing integer arithmetic ...
12
votes
2answers
517 views
Displaying a later value of a counter
I have a counter which is used throughout my document. At the beginning of each chapter (right after the \chapter command), I want to print the value of the counter which is reached immediately before ...
3
votes
1answer
123 views
How do I determine the name of the counter associated with a theorem-like environment
(A question related to this one and leading up to this one.)
Suppose I'm using ntheorem. I would like to have a command which determines the name (not the value) of the counter associated with a ...
3
votes
1answer
583 views
Easy-to-use reference-able environment for restating theorem-like environments?
This question is a development of the same issue as this one; following my own answer and later comment there, I decided it deserves a spin-off.
I would like to define an environment for restating ...
10
votes
1answer
519 views
How to count number of lines in PDF document?
I'm using the lineno package to print line numbers (each page starts with number one) in the draft of my document:
\usepackage[switch*, pagewise]{lineno}
Is there a way to read out the number of ...
11
votes
2answers
214 views
Hiding a counter if it is only displayed only one time
I have two macros on my document. \showcounter increases a counter, then displays it. \resetcounter sets the counter back to "0".
\documentclass{article}
\newcounter{counterone}
...
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}
...

