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

learn more… | top users | synonyms

4
votes
2answers
76 views

Conditional dependence of counters

Consider two counters A and B and the initial value of B is the same as of A. \newcounter{A} \newcounter{B} \setcounter{A}{1} \setcounter{B}{\theA} Consider the commands setA and setB to change ...
5
votes
1answer
197 views

How can I define my own sequence of symbols for a new counter style?

I know I can change a counter style as this: \renewcommand\thechapter{\Roman{chapter}} (The above command will make chapter numbers be written in upper case roman numerals) However, according to ...
1
vote
2answers
22 views

lncs - Changing the counter for a specific environment

I am using the llncs document class and I need to set the counter for the environment 'remark', so that when I use \begin{remark} ... \end{remark} I obtain Remark 1 wherever I am in the document. How ...
2
votes
1answer
23 views

Use arithmetic of counters inside \cline

I have a custom counter \myCounter set to, say 3. I need to produce such a table: The following code does not work: \documentclass{article} \newcounter{myCounter} \setcounter{myCounter}{3} ...
3
votes
2answers
47 views

Number of pages in preamble

I have tried this to use the number of pages as an option to a package: \documentclass{article} \usepackage{lipsum} \usepackage{lastpage} \usepackage{refcount} \newcounter{mylastpage} ...
1
vote
1answer
43 views

Local equation numbering inside proofs

According to the question asked here and a possible suggestion to the problem which equations should be numbered given here I want to ask following question; I find it a good solution to number all ...
1
vote
0answers
41 views

How to solve the error: No counter 'sectionpage' defined

I'm trying to use this answer from a previous question to get frame numbers in a table of content in a beamer presentation made in RStudio with R Markdown and knitr (see file below; in in_header.tex ...
4
votes
1answer
61 views

Reset counter via macro with \ifcase in Plain

I am not able to reset a counter to zero using a macro in Plain TeX. This code uses \ifcase and the counter animalnum to output one of a list of animal names, incrementing the counter each time it is ...
3
votes
3answers
206 views

How can I test the value of two counters?

I'd like to test the value of counters (preferably as vanilla TeX as it gets). \documentclass{article} \newcounter{counterA} \newcounter{counterB} \setcounter{counterA}{2} \setcounter{counterB}{2} ...
1
vote
1answer
24 views

Change equation number to reset at part

I would like the equation numbers to run through chapters and reset at a new part. I have tried this but it doesn't seem to work. I have tried the following shown below however it still resets with ...
2
votes
1answer
42 views

Roman numbering > setcounter to zero > hyperref confused in pdf bookmarks

I have the following problem: For my Master thesis I want to create some sections with a \Roman numbering (for toc, lof, lot, appendix...) and some with \arabic numbering (for the main text part). My ...
3
votes
1answer
50 views

Global counter on first page [duplicate]

Is it possible to have a global counter that can display its value on the first page? From what I can tell, the only way is to display on the last page after compiling.
5
votes
3answers
195 views

How to reference chapter names that include counter output?

I want to use a counter in some chapter names, this works fine for the TOC and in the chapter names themselves, but references to the chapter name appear to use the counter at the time of the ...
4
votes
2answers
57 views

Hide counter for exsheets solution environment

I am using counter-format=se.qu. for my questions which gives the following output In my case I want to hide the counters from solutions (so that I only get Lösungsvorschlag. there without the 3.1) ...
5
votes
2answers
44 views

Reset counter at beginning of proof

My goal is to get a new claim environment which automatically numbers. This is fine - I can make a counter, define a claim environment and claimproof environment which number automatically, and this ...
1
vote
1answer
60 views

Create macro depending on counter at point of definition

I have a document with various numbered objects, e.g., term rewrite systems with numbered function symbols like this: While I need a numbered output for these symbols (it should illustrate the ...
4
votes
1answer
21 views

Setting a counter to the value of a reference

I have a use case description, something along the lines of: \begin{enumerate} \item User does X. \item User does Y. \label{y} \item User does Z. \label{z} \end{enumerate} Then there is ...
2
votes
1answer
24 views

How to manually append a character after chapter counter?

book does not have \addtodef{\afterchapternum}{課}{} that is available in memoir. As a result, I have to manually append it. But how? I don't want to use memoir. MWE \documentclass{book} ...
2
votes
1answer
26 views

numberstringnum{counter}: “Missing number” error

I'm experiencing problems to use fmtcount. The code bellow return "Missing number, treated as zero" error. \numberstringnum{count} \usepackage{fmtcount} \usepackage[brazil]{babel} ...
2
votes
1answer
26 views

Counter always equal to other counter (at all times)

I know that \newcounter{newctr}[oldctr] will reset newctr to 0 whenever oldctr is incremented. How can I have newctr to have exactly the same value as oldctr at all times? In other words, how can I ...
2
votes
1answer
20 views

Restart footnote counter with apa6

I would like to reset the footnote counter to 1 after using some footnotes in the title page. I though the solution would be to simply \setcounter{footnote}{0} but it does not work. MWE below. ...
2
votes
1answer
35 views

On demand ad hoc counters

Is it possible to define a command \mycounter{<par>} in LaTeX which does the following: if a counter with name <par> exists then increment the value of that counter and print the ...
11
votes
1answer
182 views

What does the prefix “\c@” mean in build log?

I just follow the LaTeX tutorial to create the first "Hello World!" .tex file, and translate it to PDF file. Then I go through the .log file and see the following, ("C:\Program ...
1
vote
1answer
39 views

How to define a new counter in the tasks package?

I want to use the tasks package, and I want to use mynum (my alphabet enumerate) to enumerate tasks. \documentclass{report} \usepackage{amsmath,tasks} \makeatletter \def\@mynum#1{\ifcase#1\or آ\or ...
3
votes
1answer
54 views

\xdef and \fnsymbol problem under TeX Live 2015/MacPorts 2015_6

I'm writing a paper using a cls file provided by the journal (which I cannot modify). They are using some tricky code for creating table notes under tables. Problem is that this code crashes under my ...
4
votes
2answers
285 views

How do I convert a character into ascii code?

I have a custom enumerator: \newenvironment{subp}{% \begin{enumerate}[label={\textsc{\alph*.}}] }{\end{enumerate}} In the environment sometimes I need to skip to specific labels, I will do it ...
4
votes
1answer
71 views

Begin equation numbering with specific number

I would like to start my equations numbering with (8.67), so I used \setcounter{chapter}{7} but using \setcounter{equation}{66} does not help. How can I start equations numbering within chapter from ...
4
votes
1answer
67 views

Problem with counters

I want to make a presentation with certain tasks, but since there are certain problems with using enumitem with beamer, I decided to make it myself, so I have this example code: ...
3
votes
3answers
65 views

Getting the `\pageref` out from under `hyperref`

I thought I was pretty cool when I modified \ref to also print a page number when the referenced float was more than a few pages back. But I really want it to be a nice link using the hyperref package ...
4
votes
1answer
77 views

get the value of the current counter

I'd like to recover the value of the current environment counter and store it for my own uses, e.g. in the example below I'd like to store (not print) the number 1. With \@currenvir I can get the ...
6
votes
2answers
193 views

What's the way to change the size of a math symbol in plain TeX?

I find that \diamondsuit in ntxsy is too small, so I want to define a macro that will enlarge it and take into account the current font size being used. To illustrate below, I have a partial attempted ...
2
votes
1answer
62 views

Counter name of inline lists with enumitem

I am using the enumitem package and need to access the counter values after the end of the environment. With a standard \newlist{Example}{enumerate}{2} for instance, the counter value is simply ...
1
vote
1answer
52 views

Expand command in a spreadtab formula

Long story short: I'm trying to come up with a system to generate a LaTeX table dynamically from a YAML file through Pandoc and do some calculations using the spreadtab package. So far so good, the ...
2
votes
1answer
32 views

Command \alph{counter} compile error

I am trying to write a template for writing tests and homework for math classes in the familar format: 1) Given . . . a) question . . . b) question . . . Here is what I have tried: ...
2
votes
1answer
40 views

Why does my custom sectioning command crash on second run when using etoc?

Finally I have narrowed down the problem to a custom definition of a sectioning command using titlesec in explicit mode. I suspect it has something to do with me not providing an adequate counter for ...
4
votes
1answer
128 views

How to draw the clock cycle number to the rising edge?

I want to display the number of every clock cycle at the rising edge. I tried to setting a counter but it gives me this error: Package pgfkeys Error: I do not know the key ...
9
votes
2answers
245 views

How to assign TWO parents to LaTeX counter?

I am working on a own LaTeX (using KOMA-Script) class, based on scrartcl. The document structure is supposed to provide sections and subsections, as well as own environments (exercises, solutions, ...
3
votes
2answers
82 views

Counters, assignments, and groups

I have learned at my own expense to be careful with scratch counters. However, I recently encountered a situation I cannot understand. Consider the following code \documentclass{article} % print the ...
0
votes
1answer
54 views

Beamer pause and numbering [duplicate]

I'm trying beamer for the first time (but have some experience with LaTeX). I want to use \pause and number some problems, but the numbers increment when I don't want them to. There must be a simple ...
3
votes
1answer
67 views

Increase counter for each line in custom align environment

What is a good way to advance the counter in a custom align environment? I defined the regalign environment below, but to get the counter to advance with each line, I had to define a new command ...
3
votes
1answer
110 views

Reset counter \section in \part*

I'm a rookie with LaTeX, I'm using LyX, but I think this is a LaTeX problem. Im using this LaTeX preamble for reset counter after parts \usepackage{chngcntr} \counterwithin*{section}{part} But it ...
1
vote
1answer
32 views

Automatically reset the counter of a custom-defined sectioning block with titlesec

I added a custom sectioning block to my document following the instructions I found on this question: Defining custom sectioning commands. Below is a mvce: \documentclass[12pt]{article} ...
15
votes
2answers
1k views

What is the maximum integer that can be saved in a LaTeX counter?

I am using counters to save positive integers, something like that: \setcounter{mycoutervalue}{59} Is there any limit in the value I can save in a counter, in this case mycountervalue? And what is ...
3
votes
1answer
52 views

How do you set page numbering on the “part” page?

I'm trying to get something together for my thesis and part of the organization I would like to use employs the \part{} feature (it is to the chapter what a chapter is to a subsection). The beginning ...
2
votes
1answer
26 views

totcount gives wrong chapter count when appendices present

I found that totcount gives the wrong chapter count when appendices are present. In the following MWE, the chapter count should be 3 but is actually 1: \documentclass{report} \usepackage{totcount} ...
5
votes
1answer
192 views

Counter Not Incrementing

I'm trying to typeset a document in amsart and I wasn't familiar with the counter used for sections, so I just redefined the section environment to try to get the look I'm going for... unfortunately, ...
1
vote
1answer
103 views

\setcounter{section} numbering not working

Here is what I am working with: \documentclass{amsart} \newcounter{mysection} \let\realsection=\section \renewcommand\section[1]{\refstepcounter{mysection}% \subsection*{\themysection.\space #1} } ...
2
votes
1answer
39 views

Reset counter in new \chapter before the first \section

\newtheorem{lemma}{Lemma}[section] \chapter{First chap} \section{First sec} \begin{lemma} this one is correct. \end{lemma} \chapter{Second chap} \begin{lemma} This number is wrong. \end{lemma} ...
1
vote
1answer
66 views

Multirow reacting to rownumber instead of linenumber

I'm trying to create a table in LaTeX which contains a multirow as height as the rest of the table. This table appears lots of times in my document. The problem is that the second row can contain ...
2
votes
1answer
59 views

How can I redefine the description list to pass an arg to redefined items that contain TikZ nodes?

I am open to suggestions regarding my question's wording. I would like to have all description lists support an optional argument that represents node name prefixes. This will be passed to the ...