The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1answer
15 views

Temporarily modify the way a counter is displayed in an existing environment

My document has numbered assumptions 1.1, 1.2, etc. At some point in the text, I would like to define a variant of a previously-stated assumption, say Assumption 1.2, and have its counter display as 1....
2
votes
1answer
29 views

Getting a proper reference number with \ref while using custom counter and environment

I am trying to make a reference-able environment with its own counter, that I later refer to in text. I want the counter of my environment to have the style Chapter.Number . I have been able to make ...
0
votes
1answer
21 views

How to add custom counter to Table of Contents

I defined a custom counter for writing research questions in my paper: \newcounter{researchquestionCount} \newcommand{\researchquestion}[1]{ \refstepcounter{researchquestionCount}\vspace{18pt} ...
1
vote
1answer
16 views

Endnotes doesn't call counter correctly

I am trying to send numbered observations to the last page, as shown in the following MWE. How can I obtain the correct numbers to be displayed at the last page? Thank you! \documentclass{article} \...
0
votes
0answers
32 views

Restarting figure numbering

Does anyone know how to start the numeration of figures from the second figure, that is, I would like the first figure, which is illustrative, not to be included in figure counting, so that Fig. 1 ...
1
vote
0answers
16 views

beamer - overlays and counter

I have a macro with counters in it and overlays (class beamer). Every time I use overlays it increases the counters although it should not. Macro: \def\test{\thesection\stepcounter{section}} Main ...
0
votes
1answer
17 views

Conflict of hyperref with \addtocounter

For some reasons, I need to define the captions before the tables with the help of the capt-of package. When I am trying to use the hyperref package, a conflict occurs with \addtocounter and the ...
11
votes
2answers
437 views

\the vs. \value: what is the difference

I would like to understand the difference between \the and \value{} when using counters in LaTeX.
0
votes
1answer
35 views

Constant Counter is not working

I have a package for \hg and \hgunits as given here I wanted to use it like this: \item svoboda a volnost {\jednotky{22}} \item \def\aa{\value\modulo{152123}{10}} {\hg \hgunits{\aa} } HERE {\hg ...
0
votes
0answers
44 views

How to solve \begin{poem} -— \end{poem} undefined control sequence error, and reset counter with each poem environment

the MWE is here; % SAMPLE: https://imgur.com/a/5ZEN5jG \documentclass[twoside,a5paper,10pt]{book} \usepackage[T1]{fontenc} \usepackage{helvet} \usepackage{palatino} \usepackage{lipsum} \usepackage{...
1
vote
1answer
65 views

counters in theenumi 2

I have the following MWE using counters. At which place can I insert \stepcounter to increase always at the next \enumerate item? All positions which I've tried have failed with \endcsname error. \...
3
votes
2answers
145 views

counter in hexadecimal base

I have learned about counters from here. My question is, can I have a counter in other than 10 base, say hexadecimal one? How do I achieve that?
3
votes
3answers
223 views

Hieroglyphs numerals

Can someone give me a hint how do I obtain hieroglyphs numerals 1--1000 in XeTeX? I'm using this package: \usepackage{hieroglf} I need a macro with \hg{\n} which prints \n in Hieroglyphs. EDIT ...
1
vote
1answer
21 views

How to sync the Exsol counter with the section value

I am using the book document class to prepare an eBook for college algebra students. I have familiarized myself with the Exsol package to write exercises at the end of each section and then print the ...
0
votes
1answer
33 views

How to make calculations with counters?

I have three counters counterBoat, counterThink and counterWork. I want to print the integer "round"(100*counterBoat/(counterBoat+ counterThink+ counterWork)) in my document. I use the package ...
7
votes
3answers
110 views

pgfgantt: How to display week numbers according to ISO 8601 counting scheme?

In addition to the calendarian month names, I added a calendarian week counter (week 1 up to week 52) into the title of a pgfgantt-chart. Minimum Working Example (MWE): \documentclass{standalone} \...
2
votes
1answer
105 views

Set counter for tcolorbox environment in beamer

Please help me to put a simple counter in the tcolorbox environment in beamer. It only needs to go from 1,2,3,... \begin{tcolorbox}[colback=green!5,colframe=green!40!black, center,title= ] \end{...
1
vote
1answer
44 views

How do I get a counter that shows only a single number?

I am using article, in case that matters. By default, a theorem is numbered in this format: Theorem 1.2 But I would like to change it to Theorem 2 i.e. without the "x." part but just a single ...
0
votes
0answers
42 views

How do I reset group index counter

Sometimes I want labels of numbered lists like: Exercise 2.2 (a) (b) For others, I want to display like: Theorem 2.3 (i) (ii) For this end, I add \begingroup and \endgroup and \...
2
votes
1answer
29 views

Store counter in list

I have some sort of a list and want to add the actual enumi-count to that list. I assume, that in my problem I'm somehow just storing the pointer to that counter and not the value itself, so even the ...
2
votes
0answers
73 views

ConTeXt equivalent of LaTeX's \label and \refstepcounter?

In LaTeX I can label anything provided that it is numbered with a referenceable counter. Moreover, references are automatically numbered with \refstepcounter. For instance, I write the following: \...
0
votes
1answer
32 views

If I need different answer choices based on question number, can that be automated

I asked a question relating to this but I did not have a working example. Here is the original post is-there-a-way-to-alternate-answer-choices-based-on-the-question-number-act-st . To summarize I ...
2
votes
1answer
17 views

Label with counter

I have a counter called Sols. I want to create a label as follows: \label{Sol:\arabic{Sols}} From some reason I get errors. What is the solution to that? Thank you!
3
votes
1answer
40 views

Show sheet number in LaTeX

I want to show the sheet number instead page number in the header of odd pages, but it always shows 1: \documentclass[twoside]{article} \usepackage{calc} \usepackage{titleps} \newcounter{sheet} \...
2
votes
1answer
16 views

Predetermine the number of nested levels before assigning label types (followup)

In this thread, @schtandard taught me how to predetermine whether I had 4 enumerate levels or 3, and condition on this how I supecified my labels. His/her code worked beautifully so I tried to extend ...
1
vote
1answer
33 views

How do I define a counter which resets whenever a display equation environment is entered?

I'd like to have a counter that resets whenever a display math environment is entered, numbered or not. How do I accomplish that? The code below produces zeros only for the actual equation ...
0
votes
0answers
14 views

What is the subequations counter named?

If I want to change the equation numbering I can use \addtocounter{equation}{n}. How do I change the subequation numbering? E.g. if I want to label a subequation by 1.7?
1
vote
1answer
32 views

Predetermine the number of nested levels before assigning label types

I use the enumitem package to set counter types, for example most of the time I don't need more than 3 levels, and this is my preferred setup: \setlist[enumerate,1]{label={\arabic*)},ref={\arabic*)}} ...
2
votes
2answers
45 views

Setting \thecounter to user-defined format

I'm trying to get my counter (which has a value between 1--4) to display as a character (namely, the corresponding char from the string SWOT). The following looks right to me but does not do the trick:...
0
votes
0answers
18 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
30 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
48 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
19 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
28 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
28 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
20 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
66 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
18 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 ...
6
votes
3answers
276 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
48 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]...
10
votes
1answer
241 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
19 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
55 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
27 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
25 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
64 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
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 ...