Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [counters]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
43 views

Find the number of todonotes (from the previous run)

I would like to have a small '\if' there are todonotes; then show a large warning and list of todonotes on the first page. And otherwise don't. I've got no trouble accessing the todonotes counter: \...
3
votes
1answer
37 views

How to count how many times a heading appears in a ConTeXt document?

I have a book containing hundreds of activities for teachers. Each activity is designated with \section{Activity title}. \section is never used for anything else. I need some way to count how many ...
0
votes
0answers
11 views

Counter style to spell out English word for number [duplicate]

I'm sure this question has been answered somewhere, but I can't find the right key terms to find it by search. You can convert a counter to \arabic arabic numerals, \alpha alphabetic ordinals, \roman ...
0
votes
1answer
47 views

Track changes in LaTeX counters' values

I would like to execute a macro whenever a specific counter changes value. For example: \newcommand{\process}[1]{do something with argument} % ??? (What should I write here?) \stepcounter{somecounter}...
0
votes
0answers
20 views

reset exo numbering and its add-ons

I would appreciate your guidance in resolving this issue: I want to reset to zero the exercise number and the indication of the exercise and its correction: \documentclass[11pt,draft]{book} \...
0
votes
1answer
31 views

Align does not increment the equation counter

The align environment is not advancing the equation counter. Here's the code that produced the output below: \documentclass{report} \usepackage{mathtools,amsthm} \begin{document} \numberwithin{...
3
votes
1answer
157 views

Custom points table for exam

I'm trying to create a custom points table for exams. Currently, the instructors in our department write these exams in MS Word, so to ease the growing pains, I'd like to emulate the old design as ...
2
votes
1answer
41 views

Setting default value of zref abspage to avoid arithmetic overflow error while computing rotation of tikz picture logo (picture on every page)

Combing answers from this question: How to use \pageref{foo} as a number? Positioning TikZ picture on page background to be on each page of twosided document I was able to create picture of my logo ...
0
votes
0answers
22 views

Beamer slide counter [duplicate]

Is it possible to set a section counter in beamer? For example, when using the Frankfurt theme it displays a counter in each section you are in. This is problematic if you have multiple sections or ...
1
vote
2answers
33 views

How do I automate increments of section numbers?

As the title states, I wish to skip sections, specifically every other section. The manual and probably easiest way to do so is to use \setcounter{section}{#} \addtocounter{section}{1} \section ...
1
vote
1answer
111 views

Special, pre-defined “out-of-order” footnotes for boilerplate text within minipages and hyperref linking

Inside minipage environments I repeatedly need a handful of predefined footnotes (with a fixed boilerplate text) that should use symbolic footnote marks (for better detectability) alongside "normal" ...
3
votes
1answer
123 views

Do not count inserted blank pages, but keep track of them

I have a question on my MWE, well rather WE, because minimal isn't really applicable to it anymore... Let me first tell you what my expected output is. So for a twoside document, I need the first ...
1
vote
1answer
48 views

Counter expands too late

I want to make clear that I tried my hardest to make the smallest MWE I could that still captures precicely the problem I am facing. To summarize I got help from another answer in defining the ...
0
votes
0answers
22 views

Numbering all environments within chapter with the same counter? [duplicate]

I want to number my definitions, lemmas, examples, etc. as "chapter"."number of environments"... For example: 1. Chapter One 1.1 Env. A 1.2 Section One 1.2 Env. B 1.3 Env. ...
1
vote
1answer
59 views

number question

I'm trying to figure out how I can make numbers in my index sort in ascending order, right now 11 is sorting between 1 and 2, i'm trying to make it come after 9 and 10. I could add a 0 before the ...
1
vote
2answers
64 views

Numerical Increment in speaker name

I am using this answer to produce a transcript. I would like to increment each time I present a speaker, ie Speaker01_01, Speaker02_01, Speaker01_02, Speaker02_02 and so on. Presumably I would use ...
6
votes
5answers
165 views

Appending to a command while also expanding a counter

I want to append some text to a command but expand a counter while doing so. Here is an example of what the problem is: MWE: \documentclass{article} \newcommand{\topics}{} \newcounter{topic} \...
0
votes
0answers
34 views

Figure numbering after sections

I'm writing my thesis and it has chapters, section, subsections and subsubsections. In the TOC only up until the subsections are present shown below: My figures are usually under a subsection but I ...
2
votes
1answer
24 views

\thetable returns a value that is off by 1 if used in longtable environment

I noticed that the \thetable command returns the wrong number for longtable environments. I'm including the phrase "Continued from the previous page" in my table header and prepend it with \tablename\ ...
1
vote
1answer
86 views

loops on columns inside tabular environment

What is the proper way to use loops inside the tabular environment? The context of my question is generating tables using the datatool package. I need the following features: In each row, I want to ...
0
votes
0answers
15 views

Can't simultaneously have superscripted footnotes in text and footnote counter not cycling back to 1 with each chapter

I want my footnotes superscripted in the text and numbered continuously in the text of my book from 1 to n, without restarting at 1 with each chapter. In the MWE below, if I comment out the \chngcntr ...
1
vote
1answer
32 views

Wrong hyperref with repeated counter

I'm having an interesting problem with hyperref. Apparently, when a counter is reset by \setcounter{mycounter}{0} then hyperref always links to the first possible instance of the counter and not the ...
1
vote
0answers
87 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 ...
5
votes
1answer
70 views

Changing a tcolorbox listing option based on the number of lines of its listing

Consider the following code which produces listings: % ---------------------------------------------------------------------------- % % Preamble \documentclass[12pt]{article} % -----------------------...
2
votes
2answers
136 views

How to enumerate figures in sync with another counter?

I when I create a command for (for example) the examples in my article, I do it in this way: \newtheorem{teo}{Theorem}[section] \newtheorem{ex}[teo]{Example} So the enumeration is consecuent to what ...
0
votes
0answers
32 views

How can I number examples in the previous section?

How can I number the examples like the picture I attached?
2
votes
1answer
168 views

Get value of a counter

Consider this code: \documentclass{report} \newcounter{counterA} \newcounter{counterB} \begin{document} ... \setcounter{counterA}{2} \setcounter{counterB}{3} \addtocounter{counterB}{counterA} \end{...
2
votes
2answers
60 views

Problem with Counters and Cleveref

I like using amsthm for my theorems, etc, but to highlight their importance, I like exercises to be in tcolorboxes. I want the exercises in the boxes to share the same counter as my theorems. I ...
2
votes
2answers
227 views

How to set continue counter from another counter (latex)?

I want to set a counter (auto) like: \newcounter{question} \newcounter{example} Question 1. Question 2. Example 3. Example 4. Question 5. Question 6. Can you help me. Thankyou so much.
4
votes
1answer
40 views

Correctly order float counter (perpage.sty) while sharing eqn/thm counter

Sharing float (fig) and thm counter can be done with \newtheorem{theorem}[figure]{Theorem}. Correctly ordering float (fig) counter based on actual location in the PDF (as opposed to location in ...
1
vote
1answer
51 views

New title class doesn't increase counter

I'm fairly new to LaTeX and need to create a subsubsubsection in a document. After looking around I found that it could be done with titlesec. I've followed all instructions I've been able to find but ...
1
vote
3answers
70 views

Let equation numbers and enumerate use the same counter

I managed to customized the enumeration, so it mimics the format of the math equation number. Now, I would like to replace the math equation counter by the one from the enumerate, (\thechapter.\arabic{...
1
vote
1answer
22 views

Using zref return value as input for counter

I am trying to create a new counter, which is counting the page numbers to store them and reuse them later. I always remove the 3 pages, which are not numbered at the beginning of the document and I ...
1
vote
1answer
31 views

Stop resetting question counter after a new part

I use the exercise package for typesetting exercises and questions. After a new part the (sub)question counter is reseted. I would to avoid this but I don't know how. MVE \documentclass[11pt]{...
1
vote
1answer
26 views

Page double counter problem: theHpage undefined

I have a problem with links placed by a package (glossaries-extra) inside the preamble of my thesis. In this preamble I want to use roman numbers (i,ii,iii,...) as pages. This is done by my class file ...
2
votes
1answer
33 views

How can I get a frame to show the number of its own slides? (beamer)

I am trying to write a code that shows the number of slides in each frame. However, the code seems to write the slides number of slides in the previous frame In the MWE, the code reports frame 2 ...
2
votes
1answer
32 views

Question on Beamer Counter

I'm trying to create a new numbered definition environment based on exampleblock, but it doesn't work as is expected. My code: % !TEX program = xelatex \documentclass[serif, compress]{beamer} \...
0
votes
1answer
37 views

Lines of code counter

Is there a way to automatically count the lines of code of a TeX document? And if yes, is there a way to include that in the document? I would like to have something like "this document is n lines of ...
4
votes
2answers
119 views

Is there a way to make cleveref distinguish two environments with the same counter?

I believe that usually you explicitly tell cleveref what to call your label using \crefname{type}{singular}{plural}, this doen't work however as here "type" has to be the name of the counter (I ...
0
votes
0answers
41 views

How to add custom numbering to sections or subsections?

I would like to have subsections with "parts" like the following code but possibly managed automatically. \documentclass{article} \begin{document} \section{Lorem} \subsection{Ipsum part 1: Foo} \...
0
votes
0answers
30 views

One latex source producing several pdf files with continuing counters

I am looking for a way of splitting a textbook into lecturenotes for individual lectures. That is, I have a latex file textbook.tex and I would like to produce pdfs lecture1.pdf, lecture2.pdf. The ...
4
votes
1answer
171 views

Why does the \includeonly command not \stepcounter the chaptercounter for omitted chapters?

I'm a big fan of the \includeonly command, to keep pagecounts intact while only printing specific chapters. But I'm wondering why chaptercounters are not stepped in a scenario such as this one: \...
0
votes
2answers
41 views

Automatic counter with sub counter for table row - referencing

I want something like this: a referrable automatic counter and sub counter for each row in a tabularx environment. I could find a solution for a single counter here, but could not adapt it to tabularx....
4
votes
5answers
169 views

How can I access and store the current value of a counter?

My counter is being updated by a command and I want to save the current value + 1 of this counter at a specific point so that later on I am able to print it out. \newcounter{counterA} \newcounter{...
0
votes
0answers
63 views

Can Even Pages Be Right Pages?

SETCOUNTER in BOOK changes page numbers as well as directions—odd pages are right pages and vice versa. This is an example. \documentclass{book} \title{TEXT} \author{TEXT} \date{TEXT} \begin{document}...
1
vote
2answers
41 views

Exclude numerals from a custom counter environment

I have my document set up so that examples are numbered but I would prefer to be able to add my own number or title. I know I can add the title in square brackets, but how do I remove the numbers? ...
1
vote
1answer
52 views

Need LaTeX to automatically update a reference number within a table

I'm need to assign a reference number inside a table such that it automatically updates the number at the end and restarts the counter when the initial part of the reference number changes. For ...
5
votes
1answer
453 views

What does the asterisk (*) do in \arabic*?

I was wondering what the '*' (asterisk) does in the command \arabic*? My code: \usepackage[inline]{enumitem} \begin{enumerate*}[label=\textbf{\arabic*})] \item Text 1 \item Text 2 \item ...
2
votes
1answer
72 views

How to define counter for problems and examples of a text?

This is the first time that I'm going to prepare a book with Latex. I am not so familiar with advanced options of Latex, and in particular with typography. The book includes a lot of examples and ...
2
votes
1answer
37 views

Set the counter for multiple equations of the same kind

I want equations (2) and (3) to be labeled as (1a) and (1b) \documentclass[12pt,a4paper,table,usenames, dvipsnames]{book} \usepackage[table]{xcolor} \definecolor{def}{RGB}{66,103,178} \usepackage{...