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

learn more… | top users | synonyms

3
votes
1answer
104 views

Automatically count of glossary entries

I want to count all glossary entries of a document globally and automatically. Can I expand the macro \glossaryentry to do that and in such a way that I don't introduce a newly defined macro? I have ...
3
votes
2answers
144 views

How to create counters with index?

I need to create counters with names like mycounter1, mycounter2,... Basically this should be a counter-valued data array. The code like \newcounter{index} \newcounter{\csname ...
1
vote
0answers
120 views

Resetting a macro counter to 0 [closed]

I have a macro that is disabled after one use. The worksheet works fine until I need to clean the entire sheet and reuse it the next week. How do I reset the macro counter to zero so that I can use ...
7
votes
1answer
198 views

Savebox equivalent of \csname?

I would like to define a command which would increment a counter, and create a new savebox whose name is generated from the counter value. Something like: \documentclass{article} ...
7
votes
1answer
578 views

Citing many long URLs (shortening and numbering)

In my thesis I have to quote a lot from a single weblog. The URLs are mostly of this structure: blogname.providername.com/stories/123456 ...
4
votes
1answer
337 views

How to set the number of the first citation?

I am using BibTeX and natbib for my citations. In the bibliography the first entry usually starts with [1]. Now I would like to shift all the numbers in the bibliography and text by a certain offset, ...
1
vote
1answer
138 views

Counter linked to section and subsection [duplicate]

Possible Duplicate: Resetting theorem counters: \sections and (missing) \subsections I create a new counter as follow : \newcounter{question}[section] Thus at each new section ...
6
votes
1answer
184 views

Unique counter for all foot, side and end notes

When used together, as in the MWE, the text might be plagued of identical numbered marks, that is rather confusing. I want to have marks in this MWE ordered from 1 to 9 instead of three ...
3
votes
1answer
129 views

Counter not working as expected in pgfplot

Using pgfplot (for the first time), I try to create a chart with horizontal bars, sort of. See the figure. I know how to do it, but because the code is quite verbose and I have lots of data I've ...
5
votes
1answer
163 views

How can I consecutively number only some pages of a document?

The following code typesets a 12 page document; text only appears on every other page and there's an empty page between two text pages: \documentclass{article} \usepackage{atbegshi} ...
2
votes
2answers
598 views

Problems with theorem/definition/statement numbering

I have theorems, definitions, statements, that look like as follows \section{1} \subsection{1} Theorem 1.1.1 .... Statement 1.1.2 .... Definition 1.1.3.... \subsection{2} Theorem 1.2.1 .... ...
9
votes
3answers
2k views

Count number of references using biblatex

I am creating an annotated bibliography. Is there a way of obtaining a count of the number of references in a bibliography meeting certain criteria and inserting that into a document? For example ...
4
votes
2answers
1k views

Resetting counter

I have created two counters \newcounter{problem}[section] \newcounter{solution}[problem] As expected, problem resets every time section increases. However, solution does not reset when problem ...
6
votes
1answer
84 views

Beamer: suffix equivalent frametitles with a counter or index?

I wonder how to suffix equivalent frametitles with a counter or index. So for example, when I would have two slides with the same \frametitle (e.g. "Marvelous title"), it should result in Marvelous ...
4
votes
1answer
207 views

Counters for use in array/tabular cells

The following practical example \documentclass{article} \usepackage{array}% http://ctan.org/pkg/array \newcounter{tabcol}\newcounter{tabrow} \newcolumntype{C}{>{\stepcounter{tabcol}}c} ...
10
votes
1answer
88 views

How can one dynamically insert the number of subsections of the current section?

In a certain section of my document, I want to reference the number of subsections in this section ("In the following X subsections ..."). Is there any way to do this programmatically?
5
votes
1answer
2k views

No Counter Theorem1 is defined

I got an exception in the following latex code: "No Counter Theorem1 is defined", what is the problem? \documentclass[conference]{IEEEtran} \newtheorem{definition}[theorem1]{Definition} ...
4
votes
1answer
681 views

Creating variables with index (using counters)

Is there a way to add an index to a command? For example: \newcounter{count} \loop<condition> \def\var\Roman{count}{some data} \repeat The \var\Roman{count} should become the variable ...
5
votes
1answer
339 views

Is there something like \renewcounter or \providecounter?

Is there a command that creates a counter or, if it already exists, redefines it? Thing is that I'm working with nested loops. The second loop is however in a command. This means if I want to use a ...
8
votes
1answer
1k views

How to typeset the formatted counter in compactenum (paralist)?

I am using the compactenum environment from the paralist package, and would like to know how I can typeset the counter. What I mean is \begin{compactenum}[a)] \item I would like to typeset "a)" ...
4
votes
1answer
400 views

Reset counter after each item

How to reset the counter of equation numbering after each item in the enumerate environment?
3
votes
3answers
338 views

Beamer overlays and counters: compiling loop

I tried to compile \documentclass{beamer} \usepackage[english]{babel} \newcounter{xxslide} \begin{document} \begin{frame} \addtocounter{xxslide}{2} \visible<\value{xxslide}>{blabla} ...
5
votes
1answer
595 views

Using \thesubsection in header references last instance - not first

I would like to include \thesubsection in my header, referring to the first instance of subsection, and not the last as seems to be the default. The following MWE says it all: ...
4
votes
2answers
799 views

Increment counter in TikZ

How to increment counter in TikZ using code below: \newcounter{ga} %counter \setcounter{ga}{1} \begin{tikzpicture} \foreach \t in {1,...,10}{ \pgfmathparse{Mod(\t,2) == 1 ? 1 : 0} ...
4
votes
1answer
148 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
188 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 ...
6
votes
2answers
9k 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 ...
6
votes
1answer
2k 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
301 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
319 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
318 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 ...
7
votes
3answers
1k 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
105 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 ...
10
votes
1answer
630 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 ...
5
votes
3answers
6k 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
161 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
182 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: ...
5
votes
3answers
484 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
1k 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 ...
17
votes
2answers
3k 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} ...
11
votes
3answers
1k 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
736 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
263 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
328 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
169 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?
6
votes
1answer
306 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 ...
4
votes
2answers
536 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} ...
4
votes
1answer
674 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 ...
10
votes
2answers
925 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
47 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, ...