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

learn more… | top users | synonyms

5
votes
1answer
650 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: ...
5
votes
1answer
168 views

How to output the final value of some counter, like number of figures or tables in the middle of the document?

I need to put some formal statistics on the document itself somewhere in the middle, like "This document contains XXX figures and YYY tables (and may be even ZZZ formulas and PPP theorems)". Is there ...
5
votes
2answers
78 views

How can I create a counter so that it will enumerate a list I define

I am using a counter, like so: \newcounter{sectionnumber} \setcounter{sectionnumber}{0} \newcounter{courseday} \newcommand{\nextsection}{HW/Quiz \stepcounter{sectionnumber}\arabic{sectionnumber}} ...
5
votes
1answer
228 views

Problem with counter and \pause

I am trying to create a manual continuation annotation for my presentations (because I need more flexibility than provided by the automatic splitting feature of beamer). What I thought of is, for ...
4
votes
2answers
70 views

Change \part counter to text: from I to ONE

I have included the \part command into my dissertation in \documentclass{report} which automatically uses Roman numerals: I, II, etc. as its counter. Is it possible to change these to text/string ...
4
votes
2answers
2k views

How to create new counter of equation

How to create a new counter of equation. The new equation is matriz and use other sequence number. \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \begin{document} ...
4
votes
4answers
118 views

Count points per task

We have a cooperate design template for exams. The disadvantage is, that we have to count the point for each task manually. My idea was to this automatically with counters. What I am looking for: ...
4
votes
3answers
67 views

Advanced hierarchical counting for theorems

I want to number successive theorems with hierarchical counting (top level counter n, sub level counter m) in a way that I can chose from the following options for each theorem: Theorem n. ...
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 ...
4
votes
2answers
929 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
2answers
915 views

Using one counter for different floats?

I'm using two different floats, and I'd like to use the same counter for both. The standard LaTeX format for a new float is: \newfloat{type}{placement}{ext}[outer counter] I tried using this by ...
4
votes
2answers
351 views

Write a \setcounter command to a file

I try to write a setcounter command to a file (using the newfile package) by something like the following \addtostream{mystream}{\protect\setcounter{mycounter}{\myvariable}} However, since the ...
4
votes
2answers
432 views

Numbering theorems within the innermost sectioning environment present at that point in the document?

Here is what I am trying to achieve: Chapter 1. ... Theorem 1.1. ... Section 1.1. ... Theorem 1.1.1. ... Subsection 1.1.1. ... Theorem 1.1.1.1. Is this even possible? If so, how? ...
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 ...
4
votes
2answers
123 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: ...
4
votes
2answers
194 views

Reset custom counter in new frame

I'm using a custom counter to cycle bullet point colours in beamer: \documentclass{beamer} \usepackage{graphicx,color} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{marvosym} ...
4
votes
3answers
119 views

Theorem numeration shift

I would like to numerate my theorems not by chapters but by shifted chapters in such a way that the theorems in chapter 2 would read Theorem 1.1, Theorem 1.2 and so on. I need something along the ...
4
votes
1answer
68 views

Automatic tabular cell switching

Now I want to automatically switch cols and rows by counting. I have already pinned the issue down to the alignment character &: \newcounter{myRow} \newcounter{myCol}[myRow] \setcounter{myRow}{1} ...
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?
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 ...
4
votes
2answers
65 views

Insert newline if this line is the last one before a new page

I have this simple Idea: I want to have LaTeX keep count of the number of text-parts (which already works fine): \newcommand{\newpart}{ \bigskip \begin{center} ...
4
votes
2answers
462 views

Change theorem counter in Springer template

I used Springer template for my book, more concrete I used svmono. Here is a MWE, that is the shortened version of my template file. ...
4
votes
2answers
96 views

How do I create a forward reference to a user-defined counter?

I have created a counter to count enclosures: \newcounter{enclosure}{0} At the bottom of each enclosure I put: \addtocounter{enclosure}{1}\vfill\hfill\Enclosure \arabic{enclosure}\clearpage And ...
4
votes
2answers
2k views

How to get autoref working with different counters for different listing environments?

In my document I want several different custom listing environments. The solution from fraktalek works like a charm, except for one thing: \autoref doesn't work for me. I have tried the following: ...
4
votes
1answer
255 views

How to get a customized counter

I would like to change my equation counter for a specific chapter to a customized one, for example: EQ.1, EQ.2, EQ.3. Does anyone know how to do it?
4
votes
1answer
434 views

Booleans fail in tabular environment

I've got a workaround for this problem, but maybe someone knows a cleaner way to fix it. I'm using the standard packages in TexLive 2009. Here's the code that doesn't work: \documentclass{article} ...
4
votes
1answer
293 views

How can I have Beamer number slides in a frame title?

More or less what it says on the tin: I want something like: \frame{\somecounterforpagenumbers : My Title} I assume there is a built in counter that I can reference here, but I'm not sure what it ...
4
votes
3answers
271 views

Reset the counter back to one in every chapter

I have the following code to get a beautiful concept boxes with optional header for every new concept discussed. The code changes the concept number using the counter but I also need to reset it to 1 ...
4
votes
1answer
830 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 ...
4
votes
1answer
441 views

Reset counter after each item

How to reset the counter of equation numbering after each item in the enumerate environment?
4
votes
2answers
592 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
149 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 ...
4
votes
1answer
235 views

Length needs backslash but counter does not, why?

\documentclass{minimal} \parindent=0sp \newlength{\Length} \setlength{\Length}{1in} \newcounter{Count} \setcounter{Count}{10} \begin{document} \the\Length \theCount \end{document} Length needs ...
4
votes
1answer
342 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. ...
4
votes
1answer
155 views

Use float counter in a section title

I defined a new float environment for examples \usepackage{float \newfloat{example}{htp}{example} \floatname{example}{Example} that I the use throughout the document \begin{example} ... ...
4
votes
1answer
2k 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 ...
4
votes
1answer
372 views

Command to find current enum depth?

I was wondering if there was a command to find what at what depth of the enum counter (i.e. enumi, enumii, etc.) a command was at compile time. I'm attempting to create a \question command. What I ...
4
votes
1answer
112 views

Check for first occurrence of element in chapter

I'm writing a text containing several chapters. In addition, I use about 50 acronyms. Now I would like to expand the acronym in each chapter, but only at its first occurrence. For this, I'm thinking ...
4
votes
1answer
69 views

Enumerate every row, excluding the first one in a table

I want to numerate every row, excluding the first one, in a tabularx environment. In my MWE the first line, headline, is also numerated. How can I turn this off? \documentclass{article} ...
4
votes
1answer
74 views

Create new counter and give it a specific value

Consider the following: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{fancyhdr} \usepackage{caption} \usepackage{subcaption} \usepackage{expl3} \usepackage{pst-eucl} ...
4
votes
2answers
127 views

The package zhnumber without xeCJK

I need to use the function zhdigits from the package zhnumber to typeset a counter the way I want, i.e. convert 235 to 二三五. This package requires the package xeCJK to work properly, but xeCJK messes ...
4
votes
1answer
152 views

How to incorporate counter in list label [duplicate]

I want to label my enumeration like SOMETEXT01, SOMETEXT02, ..., SOMETEXT10, etc. I read through a couple of questions and know how to create a counter that adds in leading zeros. ...
4
votes
1answer
336 views

Cross-refencing a custom counter in \Alph style?

I made a 'hypothesis' custom counter in order to let LaTeX handle my hypothesis reference. My code is \newcounter{hypothese} \refstepcounter{hypothese}\label{hypo:lenght_of_words} ...
4
votes
1answer
218 views

Resume option similar to enumitem package for paralist package

I would like to know if it is possible to generate a resume option similar to that in the enumitem package for the paralist package. Note that it is not possible to add something like [resume] or ...
4
votes
1answer
413 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, ...
4
votes
1answer
149 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 ...
4
votes
1answer
27 views

How to have only 1 space between a word and a counter [duplicate]

I am using the following counter: \newcounter{foo} \newcommand\num{ \refstepcounter{foo} \thefoo.} Two (2) spaces are automatically inserted between the preceding word and the counter ...
4
votes
1answer
200 views

How to customize cross-reference numbering of custom environments?

Context: I have several environments with custom counters. As usual, I'm referencing them along to my document but I get only the corresponding counter value as reference. Example: ...
4
votes
1answer
247 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} ...
4
votes
1answer
751 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 ...