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

learn more… | top users | synonyms

2
votes
1answer
64 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
57 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
206 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
82 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) ...
4
votes
2answers
57 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
64 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
23 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
27 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
30 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
28 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
25 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
39 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
206 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
72 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
60 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
296 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
87 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: ...
3
votes
3answers
81 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
94 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
203 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
90 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
61 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
35 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
52 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
158 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
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
89 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
73 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
84 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
156 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
38 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} ...
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
57 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
35 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
201 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
169 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
44 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
89 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
61 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
87 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
125 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
74 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
63 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
136 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
74 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
125 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: ...
2
votes
2answers
169 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
43 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. ...