Questions tagged [counters]
{counters} is about macro writing involving counters. For general questions about numbering document elements, use {numbering}.
1,400
questions
0
votes
0
answers
9
views
How to count Figures and Tables by Subsections - if the section has a subsection?
Is it possible to change the code in my MWE so that all figures in sections, which are not in subsections get no zero, like Figure 1.0.1: Testfig should be Figure 1.1: Testfig. (i.e., just counting ...
0
votes
0
answers
34
views
Numbering figures like 2.1, 2.2 etc. after customization of the counter
I customized the counter only for a figure (e.g. 2.7, 2.8, 2.8.2); when I try to restore the value 2.9 I get an error because I used the following command before the begin{figure} concerning the ...
4
votes
1
answer
45
views
Package caption incompatibility: biblatex citecounter double-counts references inside table captions
It is possible to use biblatex package to count the number of times a citation has been used in the document body. This is enabled by adding citecounter=true as a package option. Even with this option,...
2
votes
1
answer
80
views
How do I change the name for a clone of enumerate using enumitem and cleveref?
I want to construct a numbered list of items for which reference have issue rather than item. I'm using cleveref and enumitem, defining issue as an alias of enumerate with \newlist, and defining the ...
1
vote
1
answer
41
views
Multiple footnotemarks inside display math mode
I'm using footnotemark and footnotetext inside an equation in display style in math mode. I already know that in order for this to work you need to write the footnotetext outside the environment, but ...
1
vote
1
answer
44
views
Creating a Custom Environment with Boxed Text and Attached TikZ Drawing
I'm trying to create a custom environment in LaTeX that includes boxed text with rounded corners, and I want to attach a TikZ drawing to the top-left corner of the box.
I've attempted to implement ...
0
votes
1
answer
28
views
Expansion in stored csname of restatable theorem
Thinking about this question, I'd like to use thmtools' restatable environment to store theorems with a number in the csname. That way one can loop through them at the end of the document to restate ...
1
vote
2
answers
28
views
Printing the value of a counter (that is indexed by another counter) before it is set
For the purposes of a MWE I have simplifed my problem to essentially displaying the number of fruits in a fruitshop before the fruits are counted. I am aware of the totcount package and this is my ...
0
votes
0
answers
10
views
Use the current citation counter value in Tufte-book \cite on the margin, instead of margin note numbers
I'm using tufte-book and I like how \cite put the reference in the margin, however I would like it to be indexed by the bibliography reference number instead that by the progressive margin notes ...
3
votes
1
answer
104
views
How to create a \pagenumbering style?
I want to create a \pagenumbering style using devanagari alphabets only for \frontmatter.
here is an example which I want to create:
i -> अ
ii -> आ
iii -> इ
iv -> ई
v -> उ
vi -> ऊ
...
0
votes
1
answer
25
views
How to show the table of contents for highlighted code?
I get this way to create \newcounter{bash} from one forum that I forgot the link here. I want to know how to create the table of contents for the codes like \tableofcontents that is showing the pages ...
0
votes
1
answer
54
views
Stepslist: "Step k of n"
I am trying to come up with a new enumerated list environment "stepslist" such that the items are marked with "Step k of n", where n is the total number of items in one stepslist ...
2
votes
1
answer
53
views
Behaviour of counters
I'd like to have a numbered list of marginal query-markers. My attempt (below) correctly gives marginal marks ???1 and ???2, but the increment within the itemize environment seems to get lost, and the ...
2
votes
0
answers
29
views
enumerate environment starting on last item number and step down up to the first [duplicate]
I would like to produce an enumerated list of items that starts on the last number and stepping down until the counter is 1:
\documentclass{article}
\begin{document}
\begin{enumerate}
\item 1st item
...
1
vote
2
answers
46
views
Why are my theorems not numbered by letters?
I'm trying to enumerate the main theorems from my paper using letters instead of numbers. I've tried using the following code but it's not working (at least the counter is!)
\documentclass[11pt]{...
0
votes
0
answers
54
views
How can I set the chapter-counter to infinity?
My professor introduced us to infinite graph-theory and made a little gimmick: Instead of increasing the chapter number by one, he set it right to infinity. Now I want to get it into my LaTeX-...
2
votes
0
answers
40
views
Missing \endcsname inserted while increasing a counter in a command
Given the following WE
\documentclass[12pt]{article}
\usepackage{unicode-math}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}{
sharp corners
}
\newcounter{mycounter}
\...
0
votes
1
answer
36
views
Number rows of table in decimal and hexadecimal with multiple counters
TL;DR My code to automatically number a table with two running counters in decimal and zero-padded hexadecimal (using the fmtcount and array packages) is not working.
I'm trying to automatically ...
0
votes
0
answers
30
views
Reuse a counter for numbering floats
I can’t find how to number floats created with \newfloat using an existing counter (like sibling=theorem but for \newfloat). Any idea?
MWE:
\documentclass[options]{article}
\usepackage{amsmath}
\...
0
votes
0
answers
29
views
Custom object that increments when inserted and can be referenced with labels
I would like to create abbreviation such as CE1, CE2, etc. that as I introduce them through the document they automatically increase the counter. I would also be able to later reference them in the ...
1
vote
2
answers
91
views
Euclidean division of two counters [duplicate]
I'd like to print the remainder of the Euclidean division by 4 of a latex counter. How do I do this?
0
votes
1
answer
36
views
Renumbering sections and linking to table of content
I am currently writing a report using LaTeX. I would like to insert an "appendix chapter" after a chapter (and before the next one).
The typical form of the report is :
\documentclass[useAMS,...
1
vote
1
answer
41
views
Print the Section Number while Referencing Custom Command
I have a custom command \goal{}
\newcounter{goalcounter}[section]
\newcommand\goal{\refstepcounter{goalcounter}{\textbf{Goal \thesection.\thegoalcounter}}}
Say in Section 1, I have Our first \goal{} ...
0
votes
1
answer
44
views
Theorem counter overwrites the (sub)section counter
I have to change my counter level from 4 to 2 and now the theorems increase the section counter. I am using amsmath and amsthm packages, my old counter code is:
\usepackage{amssymb,amsmath,amsthm,...
0
votes
1
answer
120
views
Macro to define color within SetCell
I'm using a macro to build a table dynamically, but I can't manage to color the cell with SetCell dynamically using a counter.
The colors are defined like color@1, color@2, ... and I'm using a counter ...
0
votes
0
answers
32
views
Setting counter 0 in tcolorbox
I am using tcolorbox and I want my Theorem/Example box to start with label 0. See the MWE below.
\documentclass{article}
\usepackage[dvipsnames]{xcolor} % should be before tcolorbox
\usepackage[most]{...
0
votes
1
answer
31
views
Custom figure counter: links jump to the wrong figure
As external software generates figures without labels similar to the figures included in the example, I am unable to reference them. However, I need to reference them in my text using e.g. \ref{fig:1}....
0
votes
1
answer
43
views
Custom tasks environment with a task counter
I use the tasks package extensively and it's become necessary for me to obtain the current task number/letter at any point. There doesn't seem to be a built in \theenumi like in the enumitem package, ...
0
votes
1
answer
47
views
tabularx counts expl3 more than once but LaTeX2 doesn't?
I know that tabularx runs more than once and leads to calculations being incorrect since some calculations are done more than once.
I have LaTeX2 code with counters that works great in the tabularx ...
4
votes
2
answers
224
views
How to get lipsum to accept a count as a parameter
I get the error: Missing number, treated as zero. trying to pass a counter to \lipsum. I feel like I might be forgetting some basic technique here, but I've unsuccessfully scoured the site to find out ...
2
votes
1
answer
22
views
Best way to repeat an equation with its numerical tag unchanged, without affecting the numbering of other equations [duplicate]
In a presentation, when I talk about a previous equation, I think it is better to repeat it than just referencing it. My equations in beamer are numbered. So, I want repeat equation (4.9) after ...
1
vote
1
answer
38
views
Can I get the AMS-Latex AMSTHM package to count theorems two different ways?
The AMSTHM, and AMS latex in general, do a good job of counting theorems. For example "number by section" or "number by sub sub section. To satisfy multiple authors I need to do both. ...
0
votes
1
answer
26
views
bibunit resets appendix number
I have a document that is split into two titles. The main document contains section 1 and appendix A, and the supplement contains appendix B (the rest of the appendices).
The numbering is fine without ...
1
vote
1
answer
36
views
Beamer enumeration, continue counting but keep item at fixed position, II
I have a question similar to Beamer enumeration, continue counting but keep item at fixed position. But the solution provided by https://tex.stackexchange.com/a/188046 cannot make other counters on ...
1
vote
1
answer
33
views
ToC and references list headers' labels issue with customized \section using titlesec and titletoc
I have customized the appearance of the \section command using the titlesec package, and I have also customized the appearance of the table of contents using the titletoc package.
However, it appears ...
4
votes
1
answer
84
views
Reseting the TotalCount (totcount) each section
I am trying to set-up a system where I can total a counter for each section and print this, then reset each section.
MWE:
\documentclass{article}
\usepackage{xparse}
\usepackage{ifthen}
\usepackage{...
0
votes
1
answer
66
views
ref references the correct number, but nameref uses the wrong name
This is my first question, so I'm sorry if there are detiails missing or my question could be written more clearly. Any help is greatly appreciated.
I want to use hyperref to reference the name of one ...
6
votes
1
answer
169
views
Theorem/Example numbering in LaTeX
I want Theorem/Example with the following numbers:
Theorem 1.1.
Example 1.2.1.
Example 1.2.2.
Theorem 1.3.
However, I am only able to obtain:
Theorem 1.1.
Example 1.1.1.
Example 1.1.2.
Theorem 1.2.
...
1
vote
2
answers
68
views
value of \thepage in \markright is always 1
The following latex input:
\documentclass{article}
\pagestyle{myheadings}
\markright{\ifodd\thepage ODD HEADER on \thepage\else EVEN HEADER on \thepage\fi}
outputs "ODD HEADER on 1" on ...
3
votes
3
answers
96
views
Change page numbering in preamble - latex counter modification - hexadecimal conversion
EDIT2: Sorry for this real time updates, but I am really going crazy.
I added at the bottom the new code that is compiling correctly with
showhexapagesStepOne
I edited the question trying to give ...
2
votes
1
answer
63
views
Why does my expl3 \prop_item increment my \stepcounter?
What I'm trying to do
I want to create a custom cross-referencing tag which a reader can click on and view the line of text I am referencing. However, I want the numbering of the tags to be automated ...
0
votes
1
answer
33
views
How to make a counter which changes version number after each recompile
I am pretty new to Overleaf, I struggle a lot and learn a lot too. For a specific problem, I did not find a solution, and even if there is something online, I hardly understand how to implement it, ...
0
votes
1
answer
54
views
How can I create a new environment for equations?
I'm trying to create a new environment, more specifically using a \newtcolorbox[]{}{}{}. My intention is to create an environment that brings together both the \begin{tcolorbox}[] \end{tcolorbox} and ...
1
vote
1
answer
23
views
Convert \insertappendixendpage to Roman in beamer
I want to have Roman page numbers (not frame numbers) in the appendix section both for the current and for the total page count, i.e. in the footline of my slides, I want:
1/4, 2/4, 3/4, 4/4
% ...
0
votes
1
answer
27
views
Can't get the chapter numbers displayed in the customized Table of Contents
I'm trying to get the chapter number displayed in the TOC. Here's my current code:
\documentclass{report}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{titletoc}
\definecolor{tbl}{HTML}{F035A3}
\...
2
votes
1
answer
96
views
How to use custom counter in an equation tag?
I am using custom counters for numbering examples and problems. The counters use chapter numbering followed by the problem number. For example, first problem in chapter 3 would be 3.1 and so on. In ...
0
votes
0
answers
50
views
Counting number of lines of code in align* environment
I am writing an exam paper, and I want to write the solutions immediately after the question. I then want to toggle the solutions on and off, which works via the \solution command. When solutions are ...
0
votes
1
answer
81
views
number of pages and total pages of a \section
How could I print the current page (of the section) and the total pages of a section, in the footer? Suppose the footer of page 20 reads
page 3 of 6 in section 5 (20)
because page 20 is the third ...
1
vote
1
answer
62
views
How to use a latex counter when its name depends on the result of other commands?
\documentclass{article}
\usepackage{romannum}
\begin{document}
\newcounter{proximoMes}
\setcounter{proximoMes}{2}
\newcounter{qtdDiasI}
\setcounter{qtdDiasI}{5}
qtdDias\Romannum{\inteval{\value{...
0
votes
1
answer
24
views
Print final value of variable on title-page [duplicate]
TLDR; Is there a way I can use the final value of a variable at the beginning of a document?
I want to automatically generate a report by simply adding textblocks. Every textblock-occurence increases ...