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
5
votes
2answers
291 views

Change the color of a counter number

I have created a special environment (called 'psalm') that splits the text into verses, formats them, and enumerates them. I would like to also make the numbers of the verses appear in \textcolor{...
0
votes
1answer
71 views

How to count a newenvironment call

I use a newenvironment to structure my list of symbols and list of abbreviations. In some documents there is only one of them. So I try to count the use of this environment to correct the offset in ...
0
votes
2answers
313 views

Changing the “Appendices counter” from \alph to \arabic

I am trying to get the "Chapter number" in the \begin{appendices} to be a number instead of a Letter. Since I need 2 appendice chapters, one called appendix and one called "Bilag", where Appendix ...
1
vote
1answer
76 views

Make algorithm2e use existing counter

algorithm2e provides no option to use e.g. the subsection counter to number the algorithms. It only provides an option to create a new counter within e.g. the section counter. This counter will then ...
3
votes
1answer
46 views

Checking a command with \equal and then using that command for another command?

I am trying to check the definition of a command (either arabic, roman, Roman, Alph etc.) and from this information change the formatting of section titles, while making use of the command definition ...
1
vote
1answer
235 views

How to add a visual counter in the header of each beamer slide?

I want to add a visual counter in the header of each slide using beamer, I attached a photo which indicates what I want to happen. Also, I want to add a number inside the circle, indicating the ...
0
votes
2answers
289 views

How to reset a counter to at 1 at each start of chapter?

I want the numbering of definition, lemma and theorem has the form x.y,where x is the chapter and y represents the natural order 1,2,3...I use a counter for the value of y.Here is my code, but ...
2
votes
2answers
170 views

Continuing an earlier theorem-like environment with amsthm & thmtools

When using amsthm, I want to be able to continue a particular theorem-like environment (in my case, an example) later. The continued environment should have the same number as the one it continues ...
1
vote
1answer
106 views

How to read a counter register from a file in Plain TeX?

I am a TeX user, and I would like to read a number from an auxiliary file in order to achieve things like: printing at the footing "page number X out of Total". I was trying to use the primitives ...
2
votes
1answer
64 views

Section counter fails in table of content. (Put all as 0)

Why the counter (\arabic{section}) put all sections as 0 in table of contents? Here my MWE: \documentclass[10pt]{book} \usepackage{fontspec} \usepackage{titlesec} \usepackage{lipsum} \renewcommand\...
1
vote
1answer
62 views

Skipping Numbers Using a Counter

I have several counters in my document, defined as follows: \newcounter{koala} \newcommand*\koala[1][]{\refstepcounter{koala}\textbf{\thekoala #1} } \setcounter{koala}{0} I know that I can start the ...
2
votes
1answer
325 views

counters of \declaretheorem and \newtheorem differ

I want to use thmtools in order to state questions, that I want to repeat at a latter point of my text. I declared the question-environment using \declaretheorem, but I also use theorem-environments ...
-1
votes
1answer
96 views

add counter to tcbset beamer

I have defined a tcbset as follows: \tcbset{% left=6mm, right=6mm, top=6mm, bottom=6mm, middle=4mm, } \tcbset{% outerlayer/.style={% enhanced, sharpish corners=all, colbacktitle=dcol,...
2
votes
2answers
92 views

Use counters in a bar chart

I have a document consisting of different topics within multi-variable calculus. I want to start the document with a bar chart displaying how many problems there are of each kind, based on the number ...
1
vote
0answers
169 views

Use a counter as label [closed]

I want to set the value of a counter as a label. I have the following structure: \section{First Section} Some text \subsection{First Subsection} Text again \subsection{Second Subsection} ...
1
vote
1answer
340 views

create \newtcolorbox with multiple options not working

I would like to create an advanced \newtcolorbox with multiple options and an auto counter but can't get it to work... The MWE is: \documentclass[11pt,a4paper]{article} \usepackage{lmodern} \...
4
votes
2answers
1k views

Dot between chapter number and figure number disapear after update

After a recent update the dot between chapter numbers and figure numbers disappeared. Here is a minimal example. \documentclass[]{memoir} \begin{document} \frontmatter Some text \mainmatter \chapter{...
1
vote
1answer
292 views

How to set up section, subsection and subsubsection counters correctly?

I used code from here. But I can't still manage it correctly. My code: \documentclass{scrartcl} \renewcommand\thesection{} \renewcommand*\thesubsection{\arabic{subsection}} \renewcommand*\...
4
votes
1answer
299 views

Manipulate counters in tcolorbox environments

Based on the first answer of this question, Set number of tcbtheorem, I tried to deduce some other macros involving tcb counters adapted to my needs, and find this macro, for example: \makeatletter \...
1
vote
1answer
72 views

Merging/unifying two counters

I have two (completely seperate) theorem counters, but I want them to behave as they were the same counter (incrementing the one counter increments the other, same for resetting). The obvious ...
1
vote
1answer
58 views

Custom counter printed correctly in situ, but not in nameref references

The journal that I'm submitting to has a LaTeX template (yay!), but the template suggests manually labeling supplemental figures. Since I'm too lazy to do that, I thought I would make a new counter ...
2
votes
1answer
92 views

How to properly reference counter

I have a set of different tcolorboxes defined that I use to indicate when something is important, when something is just a comment, etc. And I have created a counter \newcounter{BoxCounter} that is ...
4
votes
1answer
135 views

How to get a per page total count?

How could I in the following document replace the X by the correct per-page-total? (29, 31, 20 in my compilation). \documentclass{article} \usepackage{fancyhdr} \pagestyle{fancy} \lhead{on this page ...
2
votes
1answer
37 views

Token list of counter values

I am trying to collect certain counter values in a list of tokens. Here is my naive attempt: \documentclass{article} \newtoks\list \list={} \def\addtolist#1{\global\list=\expandafter{\the\list #1}} ...
2
votes
2answers
50 views

How to get the number of beamer's frames inside a personal environment?

Suppose I have a beamer presentation with some contiguous frames containing a "special content" that are inside a specialcontent environment. I'd like to introduce this special content with a frame ...
4
votes
1answer
214 views

Creating the same counter in multiple files

i am trying to create a counter (or better multiple independent counters) for a project with multiple people working on it over a long period of time. The tex files are structured as Main file ...
8
votes
2answers
376 views

Latex custom counters

I have been studying the way that custom enumeration labels work From source2e.pdf I get: \def\alph#1{\expandafter\@alph\csname c@#1\endcsname} \def\@alph#1{ \ifcase#1\or a\or b\or c\or d\or e\...
2
votes
2answers
187 views

Beamer: uncover frame number based on variable/counter

Current Situation: \begin{frame} % Part one of frame (including several \pause commands) % I am working on this % Part two (finished) \begin{itemize} \item<7-> Text \visible<8>{more ...
1
vote
1answer
50 views

Custom command expands counter again

I am trying to create two custom commands, that create subsections with labels and custom numbering. But when I use \nameref to get the title of the reference, it expands \decimal{reqCounter} again so ...
4
votes
3answers
309 views

How to convert macro to counter

For making the following mwe work I obviously (so I thought, but that is not true, see answers) have to convert the macro \i to a counter. But how? \documentclass{scrartcl} \usepackage{romannum} \...
1
vote
1answer
206 views

Missing \endcsname inserted in table contents defined within a foreach loop

! Missing \endcsname inserted. \countuno l.67 } From what I've seen about this error the fact that it is a tex error makes it very difficult to pinpoint its origins. Hopefully ...
5
votes
2answers
359 views

How can I set a counter to the result of a command?

I have a document where I would like to define a number of counters in terms of other counters. In order to do this I've made a command that calculates the relationship between these counters. \...
3
votes
2answers
59 views

Testing for consecutive calls to an environment

I use beamer to make slides for my statistics class and have a very nice setup now that generates output similar to powerpoint (see question: Use Beamer to put 3 slides per page with notes beside (...
1
vote
3answers
260 views

Theorem numbering with sub-theorem, without section number

I am using the IEEEtran class and \usepackage{amsthm}. How can I set a counter for the theorems, independent of the sections? Let's say my first theorem has three parts and my second theorem has two ...
2
votes
1answer
339 views

How to reset the reference counter with bibtopic

Everything is in the title. Let's suppose that there is n reference in the books.bib file, I would like the references in the second section to start at 1 and not at n+1 as produced by defaut. What is ...
2
votes
0answers
56 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
4answers
114 views

chemmacros reactions counter in report/book

Is it somehow possible to add the chapter number to the reaction counter of chemmacros and to reset it if chapter increases? In equation and figure etc. the chapter is added before the counter, like 1....
1
vote
1answer
140 views

Set theorem number and bypass counter

There are times, where I would like to repeat a theorem, for instance, if the proof goes into the appendix. In this case, I would like the two theorems to have the same number, without influencing the ...
0
votes
1answer
98 views

multiple running examples [closed]

I need to be able to have several running examples, appearing over multiple sections and whose discussion is progressed as relevant throughout the paper, in an article intended for publication. If I ...
2
votes
2answers
44 views

Makeshift array of integers using counters

I need to keep track of several counters. For that i use a bunch of counters and try to tie them inside a \ifthenelse hack producing a makeshift array of integers. I then later use the output of that ...
3
votes
1answer
185 views

How to specify a date and make calculations with it in datetime2?

I want to specify a date (and give it a name) in a master header TEX-file, then refer to that date in several independent daughter files. As this doesn't even work within a single file, this ...
1
vote
2answers
412 views

Beamer: Custom counter for frames in the current subsection

I want a frametitle that contains the name of the current subsection, followed by a counter that starts at 1 and increases for every new frame in the current subsection. I found the following ...
0
votes
2answers
106 views

Use counter in global text

I would like to set a variable or command \i available anywhere in the document, so that it changes every time it appears in the text in the same way as a counter. For example text: This is value \i ...
3
votes
1answer
672 views

LaTeX problem: \addtocounter doesn't work with babel option

I am new on this forum, so I hope to write my question in the right way. I have a document in two parts (which is a model that I need many times), each part starting with page number 1. I must then ...
1
vote
1answer
75 views

Separate page numbering for multi page environments with total pages counts for each

A document which I try to typeset with LaTeX may contain multi page environments. Such environment has his own page numeration which starting from 1. But it has to be total environment pages number at ...
3
votes
1answer
157 views

Alpha counter in a foreach loop

I need an alpha counter in a foreach loop : \documentclass{article} \usepackage{tikz} \makeatletter \newcommand{\TRAA}[1]{% % node/angle list \foreach \x/\y [count=\i from 1] in {#1} {% ...
2
votes
2answers
67 views

Number as Argument for Command

I have defined the following: \newcounter{testCounter} \newcommand{\testCommand}[1]{ \setcounter{testCounter}{#1} Your number is \ref{...
2
votes
1answer
342 views

List of \newenvironment in TOC

How can I create an additional List to appear in the TOC referencing a custom environment? Working on Overleaf, I've unsuccessfully tried applying the answers from the following questions, and I can't ...
5
votes
1answer
157 views

Do all reference-able commands/environments have counters?

Most of the things that can be referenced, e.g. sectioning commands, figures, tables, theorems, etc, appear to have counters associated with them that the LaTeX referencing system uses to keep track ...
1
vote
1answer
52 views

How to make a custom counter style work with enumerate references?

I'm trying to use the ZeroRoman style from Chapter 0/Roman numerals. I also have a type of list that should be numbered under the chapter when being referenced. I get a Missing number, treated as zero ...

1 3 4 5 6 7 22