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

learn more… | top users | synonyms

6
votes
1answer
39 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
97 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
21 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
19 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
62 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
41 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
32 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
31 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
20 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
26 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 ...
2
votes
1answer
27 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
58 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 ...
4
votes
2answers
206 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} ...
7
votes
3answers
500 views

Command that changes its definition the nth time it's used

I need a command to behave differently the first time than the next times it's called. Right now I use \newcommand\foo{First\gdef\foo{Next}}, that is, it redefines itself the first time. Moreover, I ...
2
votes
1answer
45 views

Make a counter “update” exercise in environment exercise

I wrote a book in about year 2010. Now I want to add (update) some exercises and count all updated Exercises. But I only can Update 2014. How can I make Update 0ne 2014, Update two 2014, ... or ...
1
vote
1answer
41 views

how to get rid of first bullet in paralist-bibliography

In this question, I managed to get a single-paragraph-bibliography using paralist. Now I want to get rid of the first bullet. I got it working for a normal paraenum list, but it fails for the ...
6
votes
1answer
64 views

Problem with listings when using line numbers, `name`, and `beamer` overlays

It's is well known that to ensure that a certain <counter> is automatically reset on subsequent slides of a same frame one has to use either \resetcounteronoverlays{<counter>} (for LaTeX ...
5
votes
2answers
52 views

Cross reference to counter in section title

I am trying to use a custom counter in Latex in order to auto number Use Cases in section titles (eg. \section{UC <counter>: use case title}). I also want a \usecaseref command to substitute a ...
9
votes
1answer
78 views

Changing the starting question number in examdesign

I'm trying to change the starting number for questions in an examdesign test. I have to re-use scantrons throughout the semester, so I need to change the starting number on multiple choice problems. ...
10
votes
2answers
122 views

Save counter value inside command?

I'm trying to automatically generate commands based on the value of a counter: \documentclass{article} \newcounter{count} \newcommand\generator[1]% {% \stepcounter{count}% ...
3
votes
1answer
35 views

Number equations like subsections

I would like for equations to share the same counter as subsections. For example if my document is: \documentclass{article} \begin{document} \section{A} \begin{equation} 1+1=2 \end{equation} ...
5
votes
2answers
163 views

Total number of citations

I am trying find an easy way to get the total number of citations in my thesis (in the final document - not in my Libary.bib file!). I know that I can use \citenum{last_entry} to get the number of the ...
1
vote
0answers
86 views

How to use visualcounters in latex? [closed]

I want to use Progressbar in my LaTeX document. I found some idea from the visualcounter module by Aditya Mahajan, but I don't know how to utilize that one. Because I am new to LaTeX, any one help ...
2
votes
1answer
165 views

How to imitate great looking Motion Mountain ToC, including hyperlinks?

I wanted to customize my ToC to look more or less like the one in Motion Mountain physics textbook, including clickable page numbers. My decision was to use hyperref and titletocpackages. Now it seems ...
4
votes
3answers
58 views

How to get the amount of theorems in a section

How can I get the number (i.e. amount) of theorems that appear in a particular section (or between any user determined beginning and end point) and display it in the document?
13
votes
1answer
174 views

A problem with counters

While trying to answer a question I came upon a problem with counters and I need some help. The idea is to collect answers to some numbered exercises, so the collected answers can be all typeset at ...
6
votes
1answer
35 views

Cross-referencing to self-made counters in Alignat environment

I am using the alignat environment for equations. Now, I want to refer to some places in this environment. I have made a counter to do so. \documentclass[a4paper]{article} \usepackage[fleqn]{amsmath} ...
4
votes
1answer
68 views

Using counters in macros to manage Beamer overlays

I have a very complex Tikz figure that is uncovered piece by piece during my presentation. While tweaking the presentation I decided to change the order of things being uncovered and due to the large ...
3
votes
0answers
41 views

Sum of counters at the beginning of file [duplicate]

New to this forum, but long time TeX and LaTeX user. I've had this problem recently, for which I couldn't find a solution: I'd like to print out the total possible score at a test at the top of the ...
7
votes
1answer
54 views

Weird list formatting with xwatermark and refstepcounter

I discovered some weird behaviour with xwatermark and \refstepcounter which I cannot explain. I created a list and the indentation of the first item is correct, but all others are too much indented. ...
20
votes
3answers
252 views

Chart showing the relative number of pages in the document

I'm playing with the idea of adding a chart in the begining of my thesis, showing the relative dimension of each chapter (or section, maybe). This is something that I would want to generate ...
10
votes
2answers
342 views

Check if counter exists

I've written a package that introduces a new environment: \newfloat{foo}{htb}{bar}[chapter] The package however can be used for articles, books, ... Since not all of these environments have the ...
2
votes
1answer
69 views

Enumerate not to reset counter (resuming enumerate counter) [duplicate]

I have two enumerates \documentclass[12pt]{article} \begin{document} \begin{enumerate} \item 5 + 7 = 12 \item 9 + 1 = 10 \end{enumerate} lorel ipsum, blah blah blah \begin{enumerate} \item 5 * 7 = ...
6
votes
2answers
147 views

Counters and macros?

Not sure how I should post my question but here it is: I've seen that in plain TeX, \newcount is illegal inside a macro \definition. Is there a way to allocate a register inside a macro? Also, if I ...
3
votes
1answer
68 views

Labelled subequations in table with multiple equations per row

I'm trying to make a table containing 4 equations in which the two in the left column are labelled 1a and 1b, and the two in the right column are labelled 2a and 2b. I've been able to construct such ...
4
votes
2answers
102 views

How can make a running example in LaTeX [closed]

I want a continues example where the same number is used for the example in different sections. Is it possible for LaTeX not to increase the counters for the examples? Regards minimum working code: ...
5
votes
1answer
31 views

Total number of longtables (v3.02+)

I'm wondering, are there any ways to get (and forward-reference at the beginning of the document) the total number of tables when using longtables? There are utility packages for standard table ...
1
vote
1answer
41 views

Problem with \addtocounter that doen't affect \label

I've a little issue with \label. here's the code: \chapter{previous chapter} \phantomsection \addtocounter{chapter}{1} \addcontentsline{toc}{chapter}{\Alph{chapter}~~ the chapter} ...
7
votes
1answer
80 views

How to do pagenumbering in a fancy way

How do i get uneven increasing page numbers in the first half of my document, and in the second half in the second half? Example: 1,3,5,7,8,6,4,2 Here are my thoughts on how to solve it: My LaTeX ...
2
votes
1answer
60 views

How do I enumerate sections with numbers and subsections with letters like this

How do I enumerate sections with numbers and subsections with letters like this: This is a section A. This is a subsection B. This is another subsection. Thanks
1
vote
1answer
72 views

How to refer to a (La)TeX counter early in the document?

I am programmatically typesetting a long document from database contents. For reasons of efficiency, I would like to output all generated LaTeX code as early as possible. I would also like to provide ...
3
votes
1answer
65 views

Counters to be used in section (& similar) titles (any TeX)

I use LaTeX to take notes in University. The notes are divided into chapters which are the single lessons. They are numbered. It's easy to lose track of that lesson number. So I'd like LaTeX to do ...
11
votes
1answer
84 views

Multiple \the… formats for a single counter?

Say I have a definition (\arabic) that includes a small list of sub-definitions (\alph). Sometimes I want to use full cross-references (2.3a, 2.3b, ...). But sometimes, when the main definition is ...
3
votes
1answer
62 views

Printing absolute page numbers

I'm using the pagesel package to output only selected parts of a large document. The page numbers in that document are not absolute page numbers, but pagesel (quite rightly) uses absolute page ...
3
votes
1answer
76 views

Newcommand + Stepcounter

I'm trying to come up with a command which should increase a counter and return a string including the current value of the counter. Have a look at the following minimal example: ...
2
votes
1answer
60 views

Counter too long subfigure

I'm trying to make a igure with more than 26 subfigures, therefore, the counter of the alphabet is not enough since it goes only to the z. I tried as suggested in other posts to use the package ...
2
votes
0answers
60 views

Incrementing counters with subsubsection instead of subsection [closed]

I have previously tried to make a document with questions and answers. In a previous question I was shown a great way to do this, using the answer package in combination with hyperref. Adding ...
1
vote
0answers
17 views

counter by chapter [duplicate]

Im using \usepackage{float} to make my own float of the name Chart. So that i can use \captionof{chart}{<caption>} when insering a chart. I won't the counter to be chapter based so that chart 1 ...
8
votes
2answers
104 views

Customise counters, cross references to environments

I would like to make cross references to own defined counter on environments. So far I have tried the following, \documentclass{book} \newcounter{entryc}[subsection] ...
4
votes
1answer
166 views

siamltx + amsthm: “LaTeX Error: No counter 'Theorem' defined.”

When using the LaTeX class siamltx (from the SIAM page) together with amsthm (which I need for its theoremstyle command), I'm getting the error message ! LaTeX Error: No counter 'Theorem' defined. ...