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
0
votes
0answers
16 views

How to fix page numbering/selection of page side with two abstracts (doublepage, twoside report)

I try to include two different abstract pages as for example here: Abstracts in different languages on the same page - all different solutions I found were tested. The Problem becomes obvious when you ...
1
vote
1answer
27 views

Reset counter value within new paragraph

The \newcounter{<counter-name>}[<outer-counter>] commands will define a new counter. For example, \newcounter{example}[section] command creates a new counter called example that will be ...
2
votes
1answer
40 views

My reference to my `tcolorbox` doesn't work

I'm just trying to reference one of my example in my text but it's always labelled with the upper previous counter (here the section number). My example environment is defined as exmp which are a ...
0
votes
0answers
17 views

How can I reset a counter when calling two different environments?

I defined my own counter which resets every time I call the environment ``environment1''. It works as expected. \newcounter{ado}[environment1] I wanted it to be reseted as well when I call the ...
1
vote
1answer
27 views

How I show the counter with the part number?

Here is a MWE: \documentclass{scrartcl} \newcounter{main}[part] \newenvironment{Remark}[1][]{\refstepcounter{main}\par\medskip \noindent {\underline{\textit\Large{MAIN~:\arabic{part}.\themain}}\\...
0
votes
0answers
27 views

Latex get counter value at beginning of section [duplicate]

I am trying to access the final value of a counter in each section at the beginning of the section. The reason for knowing the value ahead of time is to use it in a bar plot that summarizes ...
0
votes
0answers
18 views

How to make cross-reference two different books in one book?

MWE \documentclass[a4paper,11pt]{book} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \begin{document} % Start pages of Volume I VOLUME I: MATH BOOK %\...
0
votes
1answer
56 views

increment a counter

As I understand it, a counter is supposed to increment automatically. However, when I try to use one all I get is zeros. Here is a MWE. \documentclass[12pt]{article} \usepackage{lipsum} \newcounter{...
1
vote
1answer
17 views

How to create a second type of tables, with a different label-name

Currently I am working on a file, that already contains a lot of tables, that are all well set with ltablex. In only one of the chapters. I'm going to add tables which will only be descriptions of ...
5
votes
3answers
265 views

How to get maximum number that \newcount can hold?

Is there a command that contains greatest positive integer that \newcount can hold?
0
votes
1answer
46 views

How to define a macro with digits in its name using \def and a counter value?

I need a \def whose name involves a number, with that number being value of a counter. \documentclass[varwidth,border=5mm]{standalone} \begin{document} % COUNTER \newcounter{myC} \addtocounter{myC}{...
0
votes
0answers
10 views

Change Figure name and start new count [duplicate]

I am following an especif pattern that differentiates Charts from Figures. So I have to name Charts e count them separately from Figures. I made a generic code as example: \documentclass[12pt,a4paper]...
9
votes
1answer
236 views

Why does one get the wrong value when printing counters together?

I would like to understand why the expression \the\count0\the\count1 returns 0 when they are written without spaces. Here's the code: \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} ...
0
votes
0answers
16 views

Unprotect and remove commands inside \nameref and TOC

How do I make my commands context aware, or in particular, how do I remove commands when I refer to them within \nameref or TOC? See an example below, where a counter is incremented when I refer to a ...
1
vote
1answer
54 views

How to create local total counters?

I would like to write page numbers like this '7/9' in all minted environments of my document. The first number ('7') is the current page and the second number ('9') is the maximum number of page ...
0
votes
1answer
26 views

Countinuations of examples

In the accepted answer of the following question: Continuing an earlier theorem-like environment with amsthm & thmtools, two methods are described for continuation of examples. I would like to ...
0
votes
0answers
26 views

create a newcounter with starting value and increment the counter on every page

create a new counter with starting value and increment the counter on every page, below code is working in texlive17 but I am using texlive15 so i getting the error, is it any alternative solution. \...
0
votes
0answers
24 views

Set up an environment with multiple counters

I am writing solutions for a textbook and the exercises are labelled as [chapter].[section].[exercise] (ex: 6.4.32 would be exercise 32 from section 4 of chapter 6). How do I create a theorem ...
1
vote
2answers
63 views

How to use the same numbering counter for everything?

When writing a book, with \documentclass{book}. Like (where 1 before the dot denote the section number in each chapter, but chapter number doesn't appear) 1.1 Definition 1.2 Lemma 1.3 Theorem 1.4 ...
2
votes
2answers
29 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
34 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
10 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
45 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
16 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
28 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
108 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
38 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
32 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
29 views
+150

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
91 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
45 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
49 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
60 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
161 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
23 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
82 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
14 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
31 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
47 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
54 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
122 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
130 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
50 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
202 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
37 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
43 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 ...