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

learn more… | top users | synonyms

5
votes
2answers
102 views

Counter inside a tikz tree

I would like to increment and print counter at some node of tikz tree. I am able to do it when the tree grows to bottom, but not when it grows to left. My problem is that couter must be increment ...
1
vote
0answers
51 views

Is there a counter or variable that can be used to store numbers with decimals?

I'm working on an invoice document which has a "Grand Total" at the end of the document after some rows of invoice items. As such, I need to keep a running count of the total for each row. Using the ...
6
votes
2answers
121 views

Associate counters — stepping (many) counters simultaneously

This is (perhaps) not a real question and there maybe already an answer to my proposition/request. The situation There are packages that provide the number of the last page (i.e. lastpage or the ...
0
votes
0answers
13 views

How to add the total marks using probsoln [duplicate]

I am trying to add the total marks at the end of an exam paper using probsoln. All the questions are in a seperate file and I just use \loadallproblems to add them to the exam paper. I add the number ...
0
votes
1answer
39 views

Label counter in loop

I want to label my figures like this: \label{fig:scatterysX} Where is x a number which changes to some kind of step counter (numeric). I tried \newcounter{foo}, \stepcounter{foo} in the loop, and ...
4
votes
2answers
70 views

Change \part counter to text: from I to ONE

I have included the \part command into my dissertation in \documentclass{report} which automatically uses Roman numerals: I, II, etc. as its counter. Is it possible to change these to text/string ...
3
votes
1answer
68 views

Is there a way to know how often latex has already run? [duplicate]

A few days ago, I have seen an example of a latex file, that did conditional \defs on subsequent runs but I can't find that one again. I still remember that it was by looking into the \jobname.aux do ...
4
votes
1answer
27 views

How to have only 1 space between a word and a counter [duplicate]

I am using the following counter: \newcounter{foo} \newcommand\num{ \refstepcounter{foo} \thefoo.} Two (2) spaces are automatically inserted between the preceding word and the counter ...
1
vote
1answer
61 views

\setcounter{} destroyed my file, it does not compile any more

I was doing \paragraph to include a third subsection but my third subsection came out not numbered at all. I got help from someone suggesting me to use setcounter (see my related question: Is there a ...
4
votes
4answers
118 views

Count points per task

We have a cooperate design template for exams. The disadvantage is, that we have to count the point for each task manually. My idea was to this automatically with counters. What I am looking for: ...
4
votes
1answer
68 views

Automatic tabular cell switching

Now I want to automatically switch cols and rows by counting. I have already pinned the issue down to the alignment character &: \newcounter{myRow} \newcounter{myCol}[myRow] \setcounter{myRow}{1} ...
2
votes
1answer
27 views

Printing value of a unique counter outside mdframed

I have defined commands for a unique counter, i can retrieve the values if the counter unique name is not defined inside mdframed, what could be the problem, i cant seem to retrive the value if ...
3
votes
2answers
57 views

Problems with TeX scoping [duplicate]

If I use \global\advance\itemno by 1% \ifnum\itemno=4\the\itemno\fi I get 5. If I use \global\advance\itemno by 1% \itemno=\itemno% \ifnum\itemno=4\the\itemno\fi I get 4 as expected. Why is ...
8
votes
1answer
182 views

Maximum number of counters am I allowed to make/have?

I'm currently working on generating the pentest-reports of the company I work for with tex. I came across the totcounter package which I use for the overview table of the findings. there i'm adding ...
3
votes
2answers
39 views

how to no counting the cover and the abstract pages?

I was vieweing posts but, I can´t find the solution. I have a cover, an post-cover page, and an abstract page. How can I do to starting counting on the next page?
7
votes
1answer
69 views

Generate automatic revision's numbering tabular

Situation I have to make a cover template for a document. At the end of the page, I have to add the revision number with other useful info like this example: \begin{tabular}{lccl} Revision 0 ...
3
votes
1answer
41 views

How to change enumerate style in GSM package

I used GSM LaTeX package of AMS to write a book, in which the enumerate environment gives the result as follows: (1) If blah blah blah. (2) Else blah blah blah. (3) Or blah blah blah.... I want ...
5
votes
2answers
49 views

Corollary counter in SVmono

When using the predefined Theorem and Corollary commands using the Springer template svmono, the theorem and corollary counters are different. How can I make the counters match? The desired effect ...
3
votes
1answer
43 views

How to reset all counters at once?

I have several environments in my .tex file. I'd like to know if there is a way to reset all counters at once? To clarify what I mean, suppose we have environments theorem, proposition, etc., and ...
4
votes
3answers
67 views

Advanced hierarchical counting for theorems

I want to number successive theorems with hierarchical counting (top level counter n, sub level counter m) in a way that I can chose from the following options for each theorem: Theorem n. ...
3
votes
1answer
40 views

Subtheorems with alphabetic number

I would like to create a list of tasks using LaTeX. Therefore I created a theorem called task. For some tasks I would like to create additional subtheorems using alphabetic numbering. Currently my ...
3
votes
1answer
62 views

How do you automate the creation of titles from section titles in beamer?

I want to automate the creation of titles in beamer such that an environment Frame sets the title to this pattern <current-section> (<frame-number>) where <current-section> is the ...
2
votes
2answers
69 views

Automate a running counter through a document

The following minimal example demonstrates my situation: \documentclass{article} \usepackage{calculator} \newcommand{\pts}{0} \begin{document} \ADD{\pts}{3}{\pts}\pts \ADD{\pts}{3}{\pts}\pts ...
3
votes
1answer
29 views

How to make some visible effect on the output file of a document “invisible” or non-effective while fulfilling its “invisible” function?

Are there any commands/packages/environments that can make some code that has a visible effect in the output file as if it were not written but fulfilling its internal function? For example, ...
3
votes
4answers
101 views

How to print the value of the last \refstepcounter in the first page in the memoir class?

I made an environment named sol, that has a \refstepcounter command. I want to print on the first page of my document how many sol environments I have made in my document. ...
6
votes
1answer
49 views

Spacing issue in new environment from a theorem

I'm trying to create a theorem environment that I can use to repeat a theorem that has been previously stated in a book but number it the same as the 1st instance. I found some sort of solution: ...
7
votes
1answer
93 views

Arbitrary named counter, referenced

Apologies if this has been asked before, but I simply can't find it, despite voluminous searching. Some question answer bits of my question, but not the whole. The problem is this. I want a counter ...
1
vote
1answer
39 views

Retrieve a table with a Macro

I would like to retrieve a table with a Command which is using an new environment including a table. So basically something like: \begin{measurtab}{Test 2110} \value{0.0}{0.0} \end{measuretab} ...
1
vote
1answer
74 views

Chapter and figure numbers in TiKz externalize prefix

I would like my externalised figures to have prefixes reflecting the chapter in which they are from, but when I do: \usetikzlibrary{external} \tikzexternalize[prefix=TiKz/\value{chapter}] ...
1
vote
0answers
41 views

How to change imakeidx section title without breaking the .ind file creation?

I'm using a macro that messed around with the \section command, breaking \printindex in the process when using imakeidx. I'm pretty sure the problem lies about lines 252-253 in imakeidx.sty: ...
4
votes
3answers
76 views

Automatically add List of Abbreviations (totcount and acronym)

I would like to have a list of abbreviations automatically added if there are abbreviations. I am using acronym for the abbreviations and am currently trying to count the \ac commands using totcount. ...
4
votes
1answer
112 views

Check for first occurrence of element in chapter

I'm writing a text containing several chapters. In addition, I use about 50 acronyms. Now I would like to expand the acronym in each chapter, but only at its first occurrence. For this, I'm thinking ...
1
vote
0answers
49 views

When do variables in classes get evaluated? [closed]

I am developing a non-trivial class that is fairly large and complex. So far, everything has worked the way I designed it to be. I apologize ahead of time as I cannot provide a MWE as my question is ...
1
vote
1answer
45 views

What's wrong with that code?

\def\totalobjects@putlabel{% \addtocounter{totalpage}{\c@page} \immediate\write\@auxout{\string \newlabel{reftotaltables}{{}{\refstepcounter{totalpage}}{\relax }{}{}}} } ...
10
votes
2answers
153 views

Why is \newcount declared \outer?

I'm a user primarily of Plain TeX. Lately I get annoyed about the \outer nature of \newcount, especially when I write macros which require temporary internal variables, variables which really need not ...
2
votes
1answer
43 views

Setting Counters for Theorems

I'm using the following code to generate the "lemma" functionality in my document: \newtheorem{lemma}[theorem]{Lemma} However, the first lemma I define appears as Lemma 0.1. I tried using the ...
2
votes
1answer
48 views

How do you change table numbers in the title?

\documentclass{article} \usepackage{booktabs} \usepackage{dcolumn} \begin{document} \setcounter{page}{3} % Table generated by Excel2LaTeX from sheet 'nipo' \begin{table}[htbp] \centering ...
6
votes
1answer
79 views

Cross-reference of custom environments created with environ and TikZ package

Problem: I want to create an environment named Example, and the environment has a counter (number within chapter). I want to refer to the counter for illustration just as the table, figure and ...
8
votes
2answers
114 views

How can I explicitly ask a \label{} command to refer to a given counter?

Question In a comment there, I learnt that The latest \refstepcounter before \label sets the counter for \label Is it possible to explicitly ask a \label{} command to refer to a given counter? ...
1
vote
0answers
43 views

Changing counters across and within sections

I am making a document with glosses (using package gb4e) and sections. The glosses correspond to certain numbers within certain chapters, but these chapters do not correspond to the sections I'm ...
0
votes
2answers
37 views

How do I use aliascnt with cleveref?

I'm trying to compile the HoTT book with htlatex, and was trying to reproduce an issue that occurs with htlatex but not pdflatex. However, I couldn't even manage to get a small working example using ...
5
votes
1answer
110 views

Only show header if section number > 0

The current section name + chapter.section number is shown in the header. This is normal behaviour (what I want). Example: How can I remove the header text, if there is no section on the page. The ...
4
votes
1answer
59 views

Shared counter (between description environments) results in “undefined control sequence” [closed]

The objective is to share the counter SharedCTR1 across the description environments. The following code works with only one description environment, but not with both. \documentclass{report} ...
1
vote
0answers
48 views

Increasing counter ten by ten in Tcolorbox… and refer good?

I'm writing a book of probability in arabic, using polyglossia, and I want to increase the counter of some of my boxes ten by ten (the cause of this is that the arabic letters are numeroted with ...
2
votes
1answer
62 views

Using decimal values for figure-captions (floats)

Given a figure and a section i need the figures in that section to be labeled in a section.counter manner. Example First figure, section 3. should be Figure 3.1 I can only use \documentclass{article} ...
0
votes
0answers
21 views

Conditional on counter definition (TeX) [duplicate]

Is there a way to make a conditional where the test is the definition of a counter with a specific name, i.e. "if there exists a counter named foo, then do [bar], otherwise do [baz]"? If so, how do I ...
0
votes
0answers
34 views

General advice on how to manage references between multiple files

I need to cut my .tex files into several files, and to compile each file separately. I will need to do some work to ensure that the references and the counters work well. Before starting this work, I ...
3
votes
1answer
44 views

Hyperref did not work properly when I reset the section-counter during the document

Hyperref from the TOC bring me to the wrong part of the document when I RESET the section counter in each PART. -- When I click in the TOC on section 1 in part II, the hyperref brings to section 1 in ...
3
votes
2answers
62 views

How can I have references to several counters in a formatted way with \ref{}?

I have two counters in my document, counterA and counterB. I would like the references \ref{} in my document to be printed as 1.a) or 2., etc. where the digit refers to counterA and the letter to ...
5
votes
2answers
305 views

LastPage not defined - can't get “page x of y” - even after multiple compiles

Here is my MWE: \documentclass[11pt,letterpaper,oneside,notitlepage]{article} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsmath} \usepackage{natbib} \usepackage{graphicx} ...