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

learn more… | top users | synonyms

7
votes
3answers
519 views

Command that changes its definition the nth time it's used

I need a command to behave differently the first time than the next times it's called. Right now I use \newcommand\foo{First\gdef\foo{Next}}, that is, it redefines itself the first time. Moreover, I ...
2
votes
1answer
57 views

Make a counter “update” exercise in environment exercise

I wrote a book in about year 2010. Now I want to add (update) some exercises and count all updated Exercises. But I only can Update 2014. How can I make Update 0ne 2014, Update two 2014, ... or ...
1
vote
1answer
61 views

how to get rid of first bullet in paralist-bibliography

In this question, I managed to get a single-paragraph-bibliography using paralist. Now I want to get rid of the first bullet. I got it working for a normal paraenum list, but it fails for the ...
6
votes
1answer
95 views

Problem with listings when using line numbers, `name`, and `beamer` overlays

It's is well known that to ensure that a certain <counter> is automatically reset on subsequent slides of a same frame one has to use either \resetcounteronoverlays{<counter>} (for LaTeX ...
5
votes
2answers
79 views

Cross reference to counter in section title

I am trying to use a custom counter in Latex in order to auto number Use Cases in section titles (eg. \section{UC <counter>: use case title}). I also want a \usecaseref command to substitute a ...
9
votes
1answer
126 views

Changing the starting question number in examdesign

I'm trying to change the starting number for questions in an examdesign test. I have to re-use scantrons throughout the semester, so I need to change the starting number on multiple choice problems. ...
10
votes
2answers
179 views

Save counter value inside command?

I'm trying to automatically generate commands based on the value of a counter: \documentclass{article} \newcounter{count} \newcommand\generator[1]% {% \stepcounter{count}% ...
3
votes
1answer
48 views

Number equations like subsections

I would like for equations to share the same counter as subsections. For example if my document is: \documentclass{article} \begin{document} \section{A} \begin{equation} 1+1=2 \end{equation} ...
5
votes
2answers
207 views

Total number of citations

I am trying find an easy way to get the total number of citations in my thesis (in the final document - not in my Libary.bib file!). I know that I can use \citenum{last_entry} to get the number of the ...
1
vote
0answers
95 views

How to use visualcounters in latex? [closed]

I want to use Progressbar in my LaTeX document. I found some idea from the visualcounter module by Aditya Mahajan, but I don't know how to utilize that one. Because I am new to LaTeX, any one help ...
3
votes
1answer
198 views

How to imitate great looking Motion Mountain ToC, including hyperlinks?

I wanted to customize my ToC to look more or less like the one in Motion Mountain physics textbook, including clickable page numbers. My decision was to use hyperref and titletocpackages. Now it seems ...
4
votes
3answers
61 views

How to get the amount of theorems in a section

How can I get the number (i.e. amount) of theorems that appear in a particular section (or between any user determined beginning and end point) and display it in the document?
14
votes
1answer
197 views

A problem with counters

While trying to answer a question I came upon a problem with counters and I need some help. The idea is to collect answers to some numbered exercises, so the collected answers can be all typeset at ...
6
votes
1answer
46 views

Cross-referencing to self-made counters in Alignat environment

I am using the alignat environment for equations. Now, I want to refer to some places in this environment. I have made a counter to do so. \documentclass[a4paper]{article} \usepackage[fleqn]{amsmath} ...
4
votes
1answer
84 views

Using counters in macros to manage Beamer overlays

I have a very complex Tikz figure that is uncovered piece by piece during my presentation. While tweaking the presentation I decided to change the order of things being uncovered and due to the large ...
3
votes
0answers
42 views

Sum of counters at the beginning of file [duplicate]

New to this forum, but long time TeX and LaTeX user. I've had this problem recently, for which I couldn't find a solution: I'd like to print out the total possible score at a test at the top of the ...
7
votes
1answer
81 views

Weird list formatting with xwatermark and refstepcounter

I discovered some weird behaviour with xwatermark and \refstepcounter which I cannot explain. I created a list and the indentation of the first item is correct, but all others are too much indented. ...
20
votes
3answers
270 views

Chart showing the relative number of pages in the document

I'm playing with the idea of adding a chart in the begining of my thesis, showing the relative dimension of each chapter (or section, maybe). This is something that I would want to generate ...
10
votes
2answers
499 views

Check if counter exists

I've written a package that introduces a new environment: \newfloat{foo}{htb}{bar}[chapter] The package however can be used for articles, books, ... Since not all of these environments have the ...
2
votes
1answer
106 views

Enumerate not to reset counter (resuming enumerate counter) [duplicate]

I have two enumerates \documentclass[12pt]{article} \begin{document} \begin{enumerate} \item 5 + 7 = 12 \item 9 + 1 = 10 \end{enumerate} lorel ipsum, blah blah blah \begin{enumerate} \item 5 * 7 = ...
6
votes
2answers
167 views

Counters and macros?

Not sure how I should post my question but here it is: I've seen that in plain TeX, \newcount is illegal inside a macro \definition. Is there a way to allocate a register inside a macro? Also, if I ...
3
votes
1answer
99 views

Labelled subequations in table with multiple equations per row

I'm trying to make a table containing 4 equations in which the two in the left column are labelled 1a and 1b, and the two in the right column are labelled 2a and 2b. I've been able to construct such ...
4
votes
2answers
122 views

How can make a running example in LaTeX [closed]

I want a continues example where the same number is used for the example in different sections. Is it possible for LaTeX not to increase the counters for the examples? Regards minimum working code: ...
5
votes
1answer
36 views

Total number of longtables (v3.02+)

I'm wondering, are there any ways to get (and forward-reference at the beginning of the document) the total number of tables when using longtables? There are utility packages for standard table ...
1
vote
1answer
63 views

Problem with \addtocounter that doen't affect \label

I've a little issue with \label. here's the code: \chapter{previous chapter} \phantomsection \addtocounter{chapter}{1} \addcontentsline{toc}{chapter}{\Alph{chapter}~~ the chapter} ...
7
votes
1answer
96 views

How to do pagenumbering in a fancy way

How do i get uneven increasing page numbers in the first half of my document, and in the second half in the second half? Example: 1,3,5,7,8,6,4,2 Here are my thoughts on how to solve it: My LaTeX ...
2
votes
1answer
79 views

How do I enumerate sections with numbers and subsections with letters like this

How do I enumerate sections with numbers and subsections with letters like this: This is a section A. This is a subsection B. This is another subsection. Thanks
1
vote
1answer
83 views

How to refer to a (La)TeX counter early in the document?

I am programmatically typesetting a long document from database contents. For reasons of efficiency, I would like to output all generated LaTeX code as early as possible. I would also like to provide ...
3
votes
1answer
67 views

Counters to be used in section (& similar) titles (any TeX)

I use LaTeX to take notes in University. The notes are divided into chapters which are the single lessons. They are numbered. It's easy to lose track of that lesson number. So I'd like LaTeX to do ...
11
votes
1answer
91 views

Multiple \the… formats for a single counter?

Say I have a definition (\arabic) that includes a small list of sub-definitions (\alph). Sometimes I want to use full cross-references (2.3a, 2.3b, ...). But sometimes, when the main definition is ...
3
votes
1answer
78 views

Printing absolute page numbers

I'm using the pagesel package to output only selected parts of a large document. The page numbers in that document are not absolute page numbers, but pagesel (quite rightly) uses absolute page ...
3
votes
1answer
115 views

Newcommand + Stepcounter

I'm trying to come up with a command which should increase a counter and return a string including the current value of the counter. Have a look at the following minimal example: ...
2
votes
1answer
106 views

Counter too long subfigure

I'm trying to make a igure with more than 26 subfigures, therefore, the counter of the alphabet is not enough since it goes only to the z. I tried as suggested in other posts to use the package ...
2
votes
0answers
67 views

Incrementing counters with subsubsection instead of subsection [closed]

I have previously tried to make a document with questions and answers. In a previous question I was shown a great way to do this, using the answer package in combination with hyperref. Adding ...
1
vote
0answers
20 views

counter by chapter [duplicate]

Im using \usepackage{float} to make my own float of the name Chart. So that i can use \captionof{chart}{<caption>} when insering a chart. I won't the counter to be chapter based so that chart 1 ...
8
votes
2answers
130 views

Customise counters, cross references to environments

I would like to make cross references to own defined counter on environments. So far I have tried the following, \documentclass{book} \newcounter{entryc}[subsection] ...
4
votes
1answer
340 views

siamltx + amsthm: “LaTeX Error: No counter 'Theorem' defined.”

When using the LaTeX class siamltx (from the SIAM page) together with amsthm (which I need for its theoremstyle command), I'm getting the error message ! LaTeX Error: No counter 'Theorem' defined. ...
10
votes
1answer
91 views

Use node name with arithmetic counter expression

I want to call a PSTricks macro with a node name which involves the result of an arithmetic expression with counters. Consider the following, not working example: \documentclass{article} ...
6
votes
1answer
121 views

Problem with macro using \newcount in \caption

I have a macro \foo that performs arithmetic on it's argument: \documentclass{article} \newcommand{\foo}[1]{ \newcount\tmpR \tmpR=#1 \advance\tmpR by -1 R{\number\tmpR} } ...
6
votes
1answer
87 views

\alph without counters

When I iterate numbers with TikZ \foreach, they are stored in a macro. Now, when I need the letter corresponding to this macro, I can only convert it by saving it to a counter and then receiving it ...
6
votes
2answers
128 views

How to repeat chapter numbers

I'm writing my Ph.D. thesis, and I have to write the Introduction both in English and in Spanish. Since the content is the same, I want to repeat the number of this first chapter: Introducción. ...
6
votes
1answer
58 views

Why doesn't fancyhdr like random numbers?

In the following MWE I use \lhead{\stepcounter{step}\arabic{step}} and it works perfectly, incrementing by 1 each page. I also use \chead{\setrand{100}\arabic{rand}} and get the same number every ...
1
vote
0answers
64 views

Counter in fancyhdr not matching body

I'm trying to set a counter that says "x of 3" at the right header where x increments based on when I use \pgroup. However it shows "2 of 3" on the first page and then "3 of 3" on the second and third ...
12
votes
1answer
184 views

How to make figure and listing share their counter

I'm using the "listings" package to write pieces of code (XML, RDF, Java, etc) and I want them to have the same counter of the Figure environment. For example, Listing 1: blablabla Listing 2: ...
4
votes
2answers
87 views

Temporarily resetting figure counters within a chapter

The code below works perfectly in an article (permitting me to put two captions in the same figure and have one of them called Table, picking up the table counter—there’s a sensible reason for doing ...
7
votes
1answer
760 views

\newcounter vs \newcount [duplicate]

What are the differences between \newcounter vs \newcount? So far as my knowledge goes \newcounter is from LaTeX and \newcount is from TeX. Also, I find that \newcounter has an optional automatic ...
6
votes
2answers
221 views

How to store a counter value at some point in the document?

I'm beginning to learn LaTeX and I need some help with counters. My goal is to store the value a certain counter reaches at some point in the document and use it later. This is my attempt: ...
14
votes
1answer
296 views

Dos and Don'ts of \countdef\mycount=<number> and \newcount vs \newcounter{} in LaTeX

Let's clarify that countdef\mycount=<number> is a bad idea in LaTeX, then clarify appropriate usage of \newcount\mycount vs \newcounter{mycount} in LaTeX. Background: I only started with TeX ...
5
votes
2answers
92 views

How can I obtain total number of points?

I defined the command: \newcommand{\shcpoint}[1]{% \ifnum #1<2 (\emph{#1 point})\quad\phantom{s}% \else (\emph{#1 points})\quad% \fi } and I use it in the ...
3
votes
1answer
98 views

Changing the item numbering

Similar to Numbering exceeding the 26 letter alphabet I tried to define Roman numbering. The result is OK, but LaTeX gives me a Missing number, treated as zero.-error. MWE: \documentclass{article} ...