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

learn more… | top users | synonyms

4
votes
1answer
27 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
29 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} \usepackage{...
2
votes
1answer
34 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} \newcounter{count}...
2
votes
1answer
30 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
29 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
40 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 counter'...
11
votes
1answer
223 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 Files\MikTeX\tex\...
1
vote
1answer
167 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
66 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
312 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
94 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
70 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: \documentclass{beamer}...
3
votes
3answers
94 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
110 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
218 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
108 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
70 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
39 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
57 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
183 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 '/tikz/timing/counter/new',...
9
votes
2answers
253 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
91 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
92 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
91 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 (\...
4
votes
1answer
206 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
48 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} \usepackage{...
16
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
69 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
45 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
210 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
217 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
47 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
105 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
64 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 ...
5
votes
1answer
119 views

Reset `equation` counter for any section change, regardless of section depth

I would like the equation counter to reset automatically whenever a \section command is called, independent of section depth: \section \subsection \subsubsection \paragraph \subparagraph MWE ...
2
votes
1answer
159 views

Print iteration counter in for loop

I am new using for loops in latex, and not sure if the following is possible. This is basically what I am trying to achieve: \documentclass{article} \begin{document} \foreach \x in {a,b,c} { \...
0
votes
1answer
89 views

how to create a list for mdframed example boxs

So i found the question Make an Example and shaded box like in the book which fitted to my desires. I modified the box and counter so it fits to my whishes. (first number is the chapter second number ...
2
votes
1answer
22 views

Using undefined references to set counters

Consider this example where a number from a previous reference is being used to set a counter. \documentclass{article} \begin{document} \begin{enumerate} \item \label{e:one} One \end{enumerate} ...
2
votes
1answer
95 views

\refstepcounter within \subsection breaks \ref to \subsubsection

Usually a \ref to a \subsubsection gives 1.1.1 (from the parent \subsection). Sample: \documentclass{book} \begin{document} \chapter{chap} \section{sec} \subsection{sub} \subsubsection{subsub} ...
2
votes
1answer
168 views

Filename in line 0 of a lstlisting

I'm trying to write a lstlisting-environment which sets the filename as line 0. I tryed \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \lstset{numbers=left} % @param 1 : ...
1
vote
1answer
93 views

How to redefine the section counter in amsart? [duplicate]

I'm using the document class amsart, which defines the section counter as follows: \newcounter{section} However, I want the section counter to reset to zero every time I start a new part. Thus, I ...
4
votes
1answer
143 views

Error when >9 affiliations are added in PNAS (pnastwo.cls) LaTeX template

I ran into the following error when attempting to add more than 9 affiliations in the author list using the pnastwo.cls PNAS LaTeX template file (available here: http://www.pnas.org/site/misc/PNASTWO....
2
votes
2answers
176 views

Accessing value in forloop

This code is not compiling and creates an error "Missing number, treated as zero". \newcounter{x} \forloop{x}{0}{\value{x} < 5}{ value is \value{x} \\ } How can the value of x be printed ...
3
votes
2answers
45 views

How can I print beginning and end values of a counter within an environment?

I'm working on a formatting system for standardized tests. Within each section of a test, there are groups of consecutive questions that I might choose to contain inside an environment. \begin{...
1
vote
1answer
44 views

Use macro as totcount counter name

In the top level of the document environment, a macro defined (using \def) can be expanded into the name of a totcount counter. This, for some reason, does not work inside an environment definition. I ...
2
votes
2answers
67 views

How to use \ref to print the value of a counter the way it was originally produced?

I want to number the lines in a table with roman numerals, and then when I cross-reference them have the reference printed in the same way. For example, \documentclass{article} \begin{document} \...
1
vote
2answers
46 views

Dynamic chaptername wrong in tableofcontents

I want to print my appendix-titles with the prefix "Appendix A: [some title]" , "Appendix B: [some other title]" ... . I used the following defined commands (runnable tex-document at the end): \...
1
vote
0answers
56 views

Created counter ist counting twice (sometimes) [closed]

I wanted to create a couter to count additional chapters (appendix of the thesis). \newcounter{anhangCount} \setcounter{anhangCount}{0} \DeclareRobustCommand{\anhangPraeFix}{ Anhang \Alph{...
2
votes
1answer
74 views

How to do IF counter+1 < … THEN nicely for beautifying Biblatex backreference

This article and snippet: BibLaTeX: Customizing backreferences Produces: [4] “Tile 3”. In: () (Cited on pages 1, 2, and 3). Now I want to get the rid off this last comma (Oxford comma) after ...
1
vote
1answer
59 views

Custom item in enumerate

I would like to have an enumerate - list in which, after 1, 2, 3, 4, I need to put 4bis. How to do it?