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

learn more… | top users | synonyms

2
votes
1answer
72 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 ...
4
votes
1answer
75 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} ...
9
votes
4answers
213 views

How can I reference the current (sub)section number?

I want to create a macro that dynamically returns the current chapter, section, subsection (etc.) I'm in. I've created a macro called \getCurrentSectionNumber that does this, but it lacks the ability ...
6
votes
1answer
101 views

exporting tikz pictures starting with 1 rather than 0

I want to export my figures for an editor for import in another text editing program. I would like to have the name of the file correspond to the figures in the document. In the document they start ...
34
votes
3answers
867 views

Visual counter for LaTeX?

Does anyone know of a LaTeX package that implements a visual counter similar to the countdown counter of this context-module? It produces images like this: However, I would like to stick to LaTeX ...
7
votes
3answers
207 views

How to count cells in tabular (horizontal and vertical)?

Thank Herbert, I have a part of code with list of students and presence at lesson. Now I need counting cells horizontal and vertical in table. And counting rows too. Thank you for helping me. I am ...
6
votes
1answer
119 views

How to count the number of questions separately for different parts in exam class?

I am creating an exam with two parts, the first part is short questions and the second part is essay question, and I would like to automatically count the number of questions for the two parts ...
3
votes
1answer
335 views

How to perform simple arithmetic with page number?

I want to play around the Latex variable \thepage. How to do that? For example subtract 1 from the current page: \thepage-1
5
votes
1answer
309 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. ...
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} ...
9
votes
1answer
199 views

Bad page break with \newenvironment, \refstepcounter and hyperref

I tried to define some environment but came across bad page breaks sometimes. The minimal working example is as follows: \documentclass[b5paper]{article} \usepackage{hyperref} % page break is correct ...
13
votes
1answer
659 views

Computing a value inside \setcounter

I am using an enumerate list. I often want to decrement the counter of a list, to get output like this: 1. Some text here 2. Some more text here 2. This is a re-use of the number 3. The counter ...
7
votes
1answer
95 views

Is there a switch to turn off LaTeX counters from inside a box?

I know that amsmath typesets at least twice its material, the first one for measurement and that it takes measures (sic) to avoid some counters being updated twice. Is there a switch a macro writer ...
2
votes
1answer
307 views

Adding caption and counter to source code environment

I have a source code listing with minted environment. How can I make a counter/caption to be shown as follows. I also need to make \tableofsourcecode to enlist all the source code references. The ...
4
votes
1answer
78 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} ...
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}} ...
0
votes
0answers
27 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} ...
4
votes
2answers
241 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} ...
0
votes
1answer
77 views

Setting a new counter to be nested under Chapter number

In my thesis, I'm using a hack in a sty file that adds margin notes with entries in the Index, like so: \newcommand{\thenota}{\thechapter.{\it \alph{notas}}.} ...
5
votes
1answer
235 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} ...
6
votes
2answers
158 views

Use of a macro to set counter value in another macro

I am trying to simply set the value of the counter try which I defined previously to the value of the output of the \foo command. However this does not work. I guess that the problem is coming from ...
2
votes
1answer
74 views

Using arithmetic (other than foreach) to set label of nodes [closed]

I'd like to use integer variables to set the text inside the label of nodes, BUT WITHOUT using foreach (because these variables have their value set according to some conditional processing) Any ...
3
votes
2answers
57 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}} ...
5
votes
1answer
93 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
2answers
344 views

Trouble with Bible Style page header lines

I'm attempting to typeset a Bible for my mom and I'm running into a few problems and I was hoping someone here could help. First I'll start with the easy question. I'm currently using two columns ...
7
votes
1answer
121 views

Count the number of references containing substring in field

I have several references in a document. I'd like to display some statistics regarding the references - for example, citations with author Smith, citations between year xxxx and yyyy, citations ...
5
votes
1answer
123 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). ...
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 ...
8
votes
2answers
126 views

Custom counter steps twice when invoked from caption using caption package

I made a custom counter with a custom command that steps the counter and sets an automatic label for it. However, when invoking this from a caption AND using the caption package, my counter steps two ...
3
votes
1answer
54 views

Use the content of a counter in cline

consider the following example: \newcounter{cnt} \setcounter{cnt}{3} \begin{tabular}{l|l|l|} \cline{2-3} a & b & c \end{tabular} I have a package that generates tables with a ...
5
votes
1answer
356 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: ...
6
votes
1answer
211 views

How to put \value{counter} as value to .aux file?

I'm trying to customize eledmac settings in a way that I can use its footnote ability just like the ordinary LaTeX footnote style, but not as one paragraph per footnote but all footnotes in one ...
13
votes
1answer
200 views

Defining a counter

I'm trying to define a new counter which does the following: \documentclass[10pt]{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{array} \usepackage{tikz} \usepackage{longtable} ...
3
votes
2answers
123 views

Section numbering with numbering like 1.11

How do I set my section numbers like the given format? I'm in need of the format given below. I'm using gsm-l.cls. I'm just using tags like: \chapter{name} \section{sectionname} \begin{theorem} ...
4
votes
2answers
135 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 ...
2
votes
1answer
95 views

Add prefix command(s) - counter of todos

I would like to see the number of todos I have left. Therefor I tried to redefine the todo command as follows: \newcounter{todocounter} ...
8
votes
2answers
303 views

How can you make custom counter display types?

I'm a comp sci prof working on an exam for my students in LaTeX, using the exam class. I like to throw in a few in-jokes here and there. Unfortunately, the class breaks if you try to use 0-indexing on ...
3
votes
0answers
143 views

Reproduce the beamer miniframes environment

I would like to reproduce the miniframes features of beamer, with the bullets per section even though it would concern the chapters per part. I need a counter counting the total number of chapters in ...
6
votes
2answers
1k views

How to reset section counter

This is the barebones of my document: \documentclass[12pt]{article} \begin{document} \begin{center} \textbf{\LARGE{Topic I}} \end{center} \section{Section I} content \section{Section II} ...
5
votes
1answer
285 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 ...
7
votes
1answer
1k views

LaTeX Error: Command \c@T already defined

this is an easy question, but I couldn't find the answer just from other similar questions. A lot of people often get an error in the form: LaTeX Error: Command \XYZ already defined. ...
2
votes
1answer
112 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 ...
6
votes
1answer
234 views

How to repeat a block of code and increment a variable by one each time?

I have many images which I would like to include in a latex document. \begin{figure}[h] \centering \includegraphics[scale=0.15]{DSC_0001.jpg} \end{figure} This block of code only differs in the ...
7
votes
2answers
148 views

How to create a fixed counter?

How can I create a counter which is fixed once it has been set? The idea is to insert some kind of remarks into a text which should be numbered, but increasing with the date of actual implementation ...
5
votes
2answers
161 views

`xr` - temporarily redefine `\label` for exporting section counter to sister document?

The goal My objective is to have continuous page (and possibly section) counters for several independent documents. The purpose is a cumulative dissertation where each paper should retain the ...
1
vote
1answer
45 views

Is there any way to hook onto the advancement of a counter?

Question title really says it all - can you hook onto \stepcounter{mycounter} which probably boils down to (I may very well be wrong) \advance \mycounter by 1 Is this a hookable thing? Edit: ...
9
votes
3answers
989 views

Using counters and \ifthen in a macro: what's wrong?

I have (made, actually) a graphic of the forepaw-print of a bear that I want to use as a flourish mark at the end of chapters and a few other places. After finishing with the image, I created a mirror ...
6
votes
1answer
774 views

How to use \ifnum for arguments (expanding macros)?

I want to count my section's, figure's etc. using the totcount package. To get a general useable template I want to show only counters which are larger than zero. But it seems that total{counter} ...
3
votes
0answers
133 views

Equation counter automatically resets after using \tag [closed]

I am currently writing my master thesis, and I have just noticed that I have a problem, that I don't know how to solve. My thesis is divided into several chapters. In the first chapter I have an ...
2
votes
1answer
135 views

How to put a counter ``This page has been viewed … times'' on PDFLaTeX output?

I asked a similar question on tracking codes. which was migrated to SO. This is a bit different. Can a PDFLateX output have a counter? Can a link on a PDFLaTeX output have a counter associated with ...