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

learn more… | top users | synonyms

3
votes
1answer
144 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} ...
3
votes
1answer
513 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: ...
3
votes
2answers
75 views

Count items later in the document [duplicate]

The question is simple enough: How can I make the following output of my counter (\themycounter) say 6? \documentclass{article} \newcounter{mycounter} \newcommand{\myitem}{\refstepcounter{mycounter}} ...
3
votes
2answers
243 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 ...
3
votes
1answer
596 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 ...
3
votes
1answer
1k views

Custom numbering of listings

I have a number of listings in my document, numbered 1, 2, 3 and so on. I need a table with three listings (say, three different variants of the same algorithm), that will be numbered as 2a, 2b, 2c. ...
2
votes
1answer
30 views

Number formatting, addtocounter and calc package

I have been having troubles with the following issue: I am making an invoice template in LaTeX. I use \addtocounter to calculate values like subtotal, tax and total. This works fine, until the value ...
2
votes
1answer
35 views

totcount gives wrong chapter count when appendices present

I found that totcount gives the wrong chapter count when appendices are present. In the following MWE, the chapter count should be 3 but is actually 1: \documentclass{report} \usepackage{totcount} ...
2
votes
2answers
57 views

How to use \ref to print the value of a counter the way it was originally produced?

I want to number the lines in a table with roman numerals, and then when I cross-reference them have the reference printed in the same way. For example, \documentclass{article} \begin{document} ...
2
votes
1answer
74 views

Reset counter with starred sections as well (example using exsheets)

I am typesetting exercise/exam sheets with the “exsheets” package. It allows me to reset the question counter with every other counter step (e.g. with every section). Unfortunately this does not work ...
2
votes
1answer
473 views

Get number of each slide and total slides with respect to the whole presentation

I need to get the number of each slide and the total number of slides in order to calculate the progress of my presentation, but I can only do this for frames, as my MWE below shows. Basically I need ...
2
votes
2answers
93 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 ...
2
votes
1answer
113 views

Hide all but one instances of a custom environment

I have a file containing a number of custom environments numbered by a counter "exercisesheetnumber". I would like to use a second counter "printonly" to hide all instances of the environment but the ...
2
votes
1answer
185 views

Customised counter macro in fancyvrb

I am using the fancyvrb package in LaTeX2e. I have chosen to display line numbers as I am displaying some code. (The code I am displaying is Maple, which unfortunately is not supported by the ...
2
votes
0answers
299 views

how do I refer back to counters? [duplicate]

Possible Duplicate: How do I repeat a theorem number? I want to set up a simple macro that would do the following: It would be very similar to \label{XX}, (say, \relabel{XX}) only instead ...
1
vote
1answer
64 views

Create macro depending on counter at point of definition

I have a document with various numbered objects, e.g., term rewrite systems with numbered function symbols like this: While I need a numbered output for these symbols (it should illustrate the ...
1
vote
1answer
42 views

Use macro as totcount counter name

In the top level of the document environment, a macro defined (using \def) can be expanded into the name of a totcount counter. This, for some reason, does not work inside an environment definition. I ...
1
vote
1answer
91 views

Generate a sequence of dates in LaTeX

In LaTeX, I'd like to generate a sequence of dates, which repeats on Monday and Wednesday every week. The sequence should look like: Mon 3/30 Wed 4/1 Mon 4/6 Wed 4/8 ... I have tried to use the ...
1
vote
1answer
80 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 ...
1
vote
1answer
247 views

Creating and using commands/counters which name depends on other counter

I would like to know how can I use a counter for defining other new counters. Something like this: \newcounter{foo} \stepcounter{foo} %% Perhaps more increments, this depends of the user. %% And ...
1
vote
1answer
188 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 ...
0
votes
1answer
74 views

how to create a list for mdframed example boxs

So i found the question Make an Example and shaded box like in the book which fitted to my desires. I modified the box and counter so it fits to my whishes. (first number is the chapter second number ...
0
votes
2answers
142 views

How do I use aliascnt with cleveref?

I'm trying to compile the HoTT book with htlatex, and was trying to reproduce an issue that occurs with htlatex but not pdflatex. However, I couldn't even manage to get a small working example using ...
0
votes
0answers
33 views

Chemmacros is not resetting the reactions counter in the new chapter [duplicate]

I have a problem with chemmacros counter. When I type the reaction in different chapter, the counter of the equation doesn't restart. See the example \documentclass[twoside]{ecsthesis} ...
0
votes
1answer
537 views

restating a theorem using theomac.sty

I am trying to restate a theorem environment using theomac.sty which floats around, following a suggestion I received here: how do I refer back to counters? The package I downloaded loads well, but ...