Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [counters]

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

0
votes
1answer
21 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{...
2
votes
1answer
90 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
30 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
18 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
30 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 ...
0
votes
0answers
15 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
52 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
43 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
20 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
45 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
55 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
156 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
31 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
20 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
81 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
12 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
29 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 ...
0
votes
0answers
23 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 ...
4
votes
1answer
43 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
107 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
31 views

How can I number examples in the previous section?

How can I number the examples like the picture I attached?
2
votes
1answer
110 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
43 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
1answer
164 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
36 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
33 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
59 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
18 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
25 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
20 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
31 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
27 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
30 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
110 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
38 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
29 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
153 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
38 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
136 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
49 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
47 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
421 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
67 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
32 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{...
7
votes
5answers
185 views

Loop over an optional argument

I'd like to use the command \foo with an optional argument to step and print the counter value iterated according to the number passed. So, for example, \foo[5] should step the counter 5 times, one ...
0
votes
0answers
40 views

How do I reset the setcounter for a custom lstlistingname in latex?

I am fairly new to the world of LaTeX and am currently working on a report. Throughout the report there are several tables, figures and commands. For the figures and tables I found the working code ...
2
votes
1answer
35 views

Problem with condition in a table by using counters

I'm trying to make a conditional dynamic table that uses counter for comparison but i got a irrational error, Please see the following code: % !TEX TS-program = xelatex \documentclass[hidelinks]{...
1
vote
1answer
139 views

The construction of Rooty helix, code explanation

Could someone please explain some parts of this code? I'm newbie on LaTeX and could not understand some parts. What does this \foreach \y in {86,38,15} means? Could you explain with details what is ...
4
votes
3answers
108 views

Custom numbering style using the number of Symbols instead of Numbers

Is there any possible way to count by the number of a symbol ? For instant, if I want to print 4 versions of a letter, I assigned \arabic{#1} numbers which shows: 1 2 3 4 What I want is to ...