Questions tagged [counters]
{counters} is about macro writing involving counters. For general questions about numbering document elements, use {numbering}.
64
questions with no upvoted or accepted answers
5
votes
0answers
414 views
Why is not there any \refcounter command in LaTeX?
We have the \stepcounter command in LaTeX where
\stepcounter{counter} adds one to the counter and resets all
subsidiary counters.
We also have the \refstepcounter command where
\refstepcounter{...
4
votes
0answers
128 views
How can one count the number of cited bibtex entries of a given type?
How does one print the number of cited entries of type "@inproceedings", of type "@article", etc.
E.g., There are \ref{articlecounter} Journal articles.
4
votes
0answers
2k views
Reset question numbering in exam class without affecting grade table
Purpose: I need to create a document that contains multiple individual exams. I have already applied heavy customisations to the exam class so I wish to continue using it rather than having to start ...
4
votes
0answers
176 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 ...
3
votes
0answers
127 views
Two different page-counters in critical editions, part 2
In this question, David Carlisle provided some code to create a second page-counter in the header to indicate pages and page-breaks for critical editions. This is pretty cool. However, as documents ...
3
votes
0answers
78 views
beamer - overlays and incrementing a counter in a macro
I have a macro incrementing a custom counters in it. When this macro is used with overlays (class beamer), the counter is incremented for every overlay (as the macro appears to be called for every ...
2
votes
0answers
117 views
ConTeXt equivalent of LaTeX's \label and \refstepcounter?
In LaTeX I can label anything provided that it is numbered with a referenceable counter. Moreover, references are automatically numbered with \refstepcounter. For instance, I write the following:
\...
2
votes
0answers
118 views
counters, newcount and pgfcalendar, macros
I am trying to use the pdfcalendar library, but I think I'm confused by the definitions.
My Question: What kind of LaTeX counter/macro/variable can I use with pgfcalendar functions? Do I have to ...
2
votes
0answers
77 views
Numbering counter out of order - reledmac / reledpar
TL;DR In a parallel type setting environment using reledmac / reledpar, the footnote numbering is out of order.
I am currently creating a Latex document in a twoside class which contains a bilingual ...
2
votes
0answers
114 views
Counting number of references using environment or special bib-entry field
Suppose, that we write a survey. Somehow we need to count a number of reviewed papers. The simplest way is to create a counter, say, refsRev and add 1 at each \cite.
I created newcommand \rcite, ...
2
votes
0answers
119 views
XeLaTeX: Counters not working correctly with expex
I'm using expex for glossing translations of foreign languages. I want to label certain words in the gloss which I want to explain later with numbers in superscripts. Then I plan to use enumerate to ...
2
votes
0answers
225 views
Two different counters in chemnum package
Is there any possibility to use two independent counters within the chemnum package? I would like to label (by replacing the tags in my .eps file) substances in reactions and steps in catalytic cycles ...
1
vote
0answers
46 views
LaTeX Error: No counter 'refsection' defined generated by \listoftheorems
I was wondering if anyone could help me with this problem. Somehow I'm getting the following error message
! LaTeX Error: No counter 'refsection' defined.
See the LaTeX manual or LaTeX Companion for ...
1
vote
2answers
42 views
How to total item counts in multiple enumerate environments, respecting \include
I'm writing a book in which each chapter ends with a list of numbered exercises. I would like to persuade LaTeX to count the total number of exercises in the book, to be referred to with \ref or ...
1
vote
0answers
15 views
Todonotes custom counter not referencing in align environment
I have set up todonotes with a counter and would like to reference the tasks I create.
In the align environment, I am unable to place the task in the margin so it is inline in a \text{} command.
...
1
vote
0answers
65 views
Does this environment have the same effect as I think?
I started using Latex in the class of a professor who gave a little template setup that used amsart. Since then, I took his command definitions and shortcuts into a class of its own. He counted ...
1
vote
0answers
26 views
Count references and link pages
I'd like to know how to count the number of times that I cited some reference and to mark the pages that I make the reference. Below you will find an exemple, where "Citado 3 vezes nas páginas vii, 28 ...
1
vote
0answers
31 views
How do I make my Theorem, Corollary (and other) environments to share the same counter?
I have a few self-defined theorem environments:
\newtheorem{lemma}{Lemma}[section]
\newtheorem{prp}{Proposition}[section]
\newtheorem{theom}{Theorem}[section]
\newtheorem{coro}{Corollary}[section]
...
1
vote
0answers
33 views
newcommand weirdness with optional arguments and `\value`
In the following MWE
\documentclass{article}
\newcounter{test}
\newcounter{tesp}
\newcommand{\vt}[1]{\value{tes#1}}
\newcommand{\vdt}[1][t]{\value{tes#1}} % This command with default `t` doesn't ...
1
vote
0answers
31 views
Beamer equivalent to \clearpage for handout notes
When producing notes for a beamer handout, I frequently have to bump the notes to a subsequent page to prevent page overflow.
I have typically done this using a \note<handout:PN>{...} command, ...
1
vote
0answers
56 views
Tex Capacity Exceeded with csname and recursion
I would like to try to do some input with relative paths (like in the import package but I would like to write it)
When I compile I have a Tex Capacity exceeded. Could you maybe help me with this ...
1
vote
0answers
85 views
Assign marks to questions and then add them all up
I would like to assign and tally up points on LaTeX.
Here is a snip it of my exam paper.
\documentclass{exam}
\begin{document}
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
\item Given $z=\...
1
vote
0answers
57 views
Too many subfigures, counter too large in pylatex
I am trying to create a figure that has more than 26 subfigures using pylatex. I understand from other posts such as Counter too long subfigure that the way to fix this in a normal LaTeX editor would ...
1
vote
0answers
234 views
How to count section pages in LaTeX and display them in a progress bar?
I am currently writing a student work in latex as a scrartcl. I would like to make an overview in my document of how many pages I still have to write in each section. So like an actual/target ...
1
vote
0answers
101 views
Counter for version of document
I am trying to create a version counter of the document, to indicate which version the user is reading. Based on this answer:
Add version number to document from file I managed to create this counter....
1
vote
0answers
675 views
Print character count
Background inspiration and code:
\documentclass{article}
\usepackage{bashful}
\pagestyle{empty}
\bash
texcount -sum -1 tmp.tex
\END
\begin{document}
%here is a front page and a table of contents
%...
1
vote
0answers
101 views
Bar graph with elements from the document
In my document, I define some elements which all have a number (from 1 for the first to n for the last one) and a level (1, 2 or 3).
At the end of the document, I'd like to create a bar-graph with ...
1
vote
0answers
165 views
How to change imakeidx section title without breaking the .ind file creation?
I'm using a macro that messed around with the \section command, breaking \printindex in the process when using imakeidx. I'm pretty sure the problem lies about lines 252-253 in imakeidx.sty:
\def\...
0
votes
0answers
17 views
Longtable with numbered list without using preset counter names
I am trying to make a longtable to list out publications but I want to use arabic numerals combined with latin capital letters for different categories. This is what I have for only a few items, but I ...
0
votes
1answer
28 views
Plot Totcounter-Value
I'm trying to get tikzpicture and pgfplots working with totcount to create the following bars.
I count all occurrences of the different ratings with \totcounter and in text I am able to read the ...
0
votes
0answers
49 views
Customize text of cross reference with values of multiple counters
I'm looking for a way to make cross reference, in which the text of hyperlink include several counters in a customized format, as following picture:
The counter theorem are defined as follow:
\...
0
votes
0answers
28 views
How do I augment the numbers of the counted theorems by one?
Suppose I have some theorems 1 to n. How may I display these as Theorem 2 through n+1?
0
votes
0answers
12 views
Get the first (and last) page number of an arbitrary section and subsection anywhere in a Beamer document
For example, I would like to print out, on the first frame of section X, and again the first frame of section X-subsection 1, the beginning (end) page number of section X, subsection 1. Can I do that?
...
0
votes
0answers
42 views
Setting a common counter to different environments (figures, tables, theorems, etc)
I am trying to set a common counter to the environments figure, table, algorithm, thm, lstlisting. After searching over the internet I found a partial solution: to add the following code at the ...
0
votes
0answers
24 views
Make section counter not reset in a new chapter
I am trying to create the following structure:
Chapter 1
I. This is a Section
II. This is a Section
III. This is a Section
Chapter 2
IV. This is a Section
...
0
votes
0answers
23 views
Unable to reference sections in supplemental document
SOLUTION: It turns out it was a documentclass problem. By removing prl from \documentclass[reprint,aps,prl,superscriptaddress,notitlepage]{revtex4-2} it fixed my problem.
I'm having a problem where I ...
0
votes
0answers
18 views
Class memoir Error: listing is not a counter
I am trying to use \counterwithout{listing}{chapter}
Chngcntr: \counterwithout not working
Number listings the same way as figures and tables
But memoir keeps complaining Class memoir Error: listing ...
0
votes
0answers
18 views
The reference number is inconsistent to the caption number after using \setcounter command
I use \setcounter command to reset the algorithm number. However, when I use \ref command to quote this algorithm, the displayed number is inconsistent to the number in the title of the algorithm. How ...
0
votes
0answers
18 views
Continuous \inputlineno for documents with \include and \input
The \inputlineno counter represents the current line of code in the .tex file. \the\inputlineno returns said number.
If, however, I have a document which \includes or \inputs other .tex files, \...
0
votes
0answers
37 views
TeX4ht: broken hyperlinks when using internal counters for `\newtheorem`
MWE:
\documentclass{amsart}
\usepackage{hyperref}
\newtheorem{lemma}[equation]{Lemma}
\begin{document}
We see Lemma~\ref{lem:test}
\begin{lemma}
We have
\begin{equation}
i^2=-1
\end{...
0
votes
0answers
40 views
Customize chapter number in multiple levels
I'm writing a portion of an article (using the article class) and my part has to be included as "2.4 Chapter Title". The final pdf output has to be merged with the other chapters. Considering that not ...
0
votes
0answers
39 views
Circled number counter in a hyperref TextField name using Tikz
I am currently trying to make a form using the hyperref package. For more visibility, I'm trying to put a circle around a counter in the Textfield name.
I am using the circled counter code I found ...
0
votes
0answers
57 views
How to set multiple counters in LaTeX?
Suppose I defined theorem-like environments in amsthm: problem, exercise, solution. I want something like this:
Problem 1.
Solution 1.
Solution 2.
Exercise 1.
Solution 1.
Solution 2.
However, ...
0
votes
0answers
19 views
Double Counters in Headers and Multicols
A solution for doublecounters in headers using the memoir class given recently does not work in multicols Doublecounters in header, first and last combination. Look at page 2 and page 4. Any ...
0
votes
0answers
17 views
How to reset isov2 note counter?
I am using isov2 and are extensively using the \begin{note} and \end{note} in the \newglossaryentry environment.
I need to start the counting at one, [1,] for each \newglossaryentry entry.
How do I ...
0
votes
0answers
27 views
ntheorem counters and sub-counters without any section divisions
I'm writing an academic article response memo in LaTeX and would like to create counters for each reviewer and sub-counters for each of their comments, e.g.:
Reviewer 1.1 (Problem X): Reviewer ...
0
votes
1answer
101 views
Change bibliography starting number for document class apsrev
I am currently using \begin{thebibliography} for my references at the end of a scientific paper.
The numbers of the citations go from [1] to [10], as usual.
I would like to change this.
I would ...
0
votes
0answers
17 views
Reference counter does not include chapter number
Trying to get reference numbers right to a custom defined environment. In short I have:
\newcounter{MathToolBox}[chapter]\setcounter{MathToolBox}{0}
\newcommand{\theBox}{\arabic{chapter}.\arabic{...
0
votes
1answer
82 views
Custom counter in tasks environment
I am using a custom counter to generate the labels in a \NewTasksEnvironment (package tasks v.1.1a). This is the approach I had chosen since I use this counter elsewhere (I need to increment and ...
0
votes
1answer
54 views
Adding table of contents as a “chapter”
I´m beginning my project with the chapter "thesis statement" in front of the table of contents and the list of abbreviations (also a chapter). I know that you can add custom entries to the toc via \...