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

learn more… | top users | synonyms

5
votes
2answers
98 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 ...
5
votes
1answer
182 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} ...
5
votes
1answer
8k views

Changing number within \numberwithin causes malfunction but no compile error

An interesting one here. It could be a bug or I might be missing a trick. In my thesis I use \numberwithin{}{} to have numbering done within sections. Top level is chapter, so it goes ...
5
votes
2answers
4k views

Access the chapter/section number and the chapter/section label through variables

Often I find myself in the situation that I'd like to design how chapters and sections look. I know there are packages that help to design such things, but non of them seems to give me the option to ...
5
votes
1answer
959 views

Beamer overlay and counter

I have a counter that I want to use for the beamer \onslide command. Using \newcounter{coun} %.... % \onslide<\coun ->{ ....} doesn't work. What is the correct way to do this?
5
votes
1answer
173 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
1answer
54 views

How do I feed evaluated references into this sorting routine?

Below is some code I cobbled together from examples found on the net. I would like the sorted list routine to use the results of evaluating \ref rather than using the literal argument of \ref. ...
5
votes
1answer
48 views

Passing current counter value to stack data structure

I'm trying to combine a stack data structure with a \newcounter{} definition so that I can automatically pair together a collection of points scattered throughout my text. Each point is either ...
5
votes
1answer
76 views

Defining a command that conditionally defines/checks for counters

In order to complete one custom package command I needed an internal macro, I called it \@test@count{❬argument❭}, and should accomplish the following: Internally defines a new counter \❬argument❭ ...
5
votes
1answer
292 views

Beamer total slides counter?

Thanks to Change the page number of slides in notes when using | handout: command I can count the slides in a frame. What I would also like is a counter for the total number of slides in a frame. ...
5
votes
1answer
217 views

How to use a counter inside node<> in TikZ?

I'm trying to draw nodes one by one on a list of predefined coordinates. \documentclass{beamer} \usepackage{caption} \usepackage{pgf,tikz} ...
5
votes
1answer
92 views

Using counter within database

I try to add a countervalue into a database. But if the database content will be printed, the value is allways the maximum value. I have a simple code example ...
5
votes
1answer
120 views

Carrying counters over to another file

I have two files, say file1.tex and file2.tex. file1.tex is the first of a series of files, and it begins with counters (say chapter 1 for instance, although my counters are not used for chapters). ...
5
votes
1answer
325 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: ...
5
votes
2answers
145 views

How to reference the most recently used multiply-defined label

I want to be able to do something like the following: \incmycounter{abc} %% counter value initialized to 0; associated with label 'abc' \incmycounter{def} %% counter value initialized to 0; ...
5
votes
1answer
301 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} ...
5
votes
1answer
710 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
2answers
81 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
280 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
81 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
139 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
97 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
934 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
365 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
451 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
95 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
145 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
234 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
127 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
69 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
2answers
68 views

How can I have references to several counters in a formatted way with \ref{}?

I have two counters in my document, counterA and counterB. I would like the references \ref{} in my document to be printed as 1.a) or 2., etc. where the digit refers to counterA and the letter to ...
4
votes
3answers
62 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
118 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
67 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
576 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
105 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
260 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
459 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
65 views

Enumerating tabular data

How do you enumerate tabular data like this? a) stuff stuff stuff b) stuff stuff stuff c) stuff stuff stuff I considered making a table then using a counter: ...
4
votes
1answer
347 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
309 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
905 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
481 views

Reset counter after each item

How to reset the counter of equation numbering after each item in the enumerate environment?
4
votes
2answers
630 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
154 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
239 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
39 views

How do I disable the theorem counter for \autoref when using an extended theorem name?

I’m writing a paper, and I need to quote a theorem by a mathematician whom we’ll call Genius. This theorem already goes by a well-known name, say Genius’ Special Theorem. I’d like to cite this theorem ...