Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [counters]

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

1
vote
1answer
19 views

Labelling a custom counter inside align env

I created a new counter and new commands to label and refer to this counter (the latter looks redundant here because I stripped away some formatting I have in it) according to this answer. As the ...
1
vote
2answers
49 views

Fractions and counters in a \foreach list of pairs

I'm trying to create a macro that will take a list of pairs as an argument in order to draw a pie chart. I'm trying to make it so that portions of the pie are specified as a fraction less than 1. Here'...
7
votes
3answers
876 views

Creating a nice-looking box without using minipage

I would like to create the following box and title without using minipage With : small box before Title Title with counter \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{...
5
votes
4answers
284 views

\ref takes reader to incorrect section

Context In the document I'm writing, I have redefined each environment and have included a new counter, called counter, to help with the numbering of the environments. My intention is for each ...
1
vote
1answer
28 views

Custom Counter Longtable

I would like to create a custom counter for the following table such that it appears "Table 6.1: Sample Statistics: Swiss Model". In other words, I would like to manually input the counter settings. ...
1
vote
0answers
29 views

How to Create a Counter for the Number of Builds

I just finished writing my Master's thesis using Latex. When I was executing my last builds, I was thinking that it would have been quite interesting to count the total number of builds it had taken ...
2
votes
1answer
46 views

Reset equation numbering after each problem

I started using the ShareLateX Basic Homework Template: https://www.sharelatex.com/templates/examples/basic-homework-template in which are defined the 'problem' and 'solution' environments, defined ...
2
votes
1answer
39 views

Questions about Counter

I am new to TeX and I am using a template to type something. And I want to do the following change of the format: I want to use the same counter for all the Theorem, Propostion, Corollary, etc. I ...
2
votes
1answer
24 views

Two pages “1” with package hyperref

When compiling a LaTeX document, I get two pages numbered at "1": the front page and the first of the table of contents. Here's a MWE: \documentclass[12pt,a4paper]{report} \usepackage[english]{babel} ...
3
votes
1answer
24 views

Labelling and Referencing Multiple Custom Counters Together

This is what I have. \documentclass[12pt,a4paper]{article} \newcounter{theorem}[section] \newcommand\theorem{\stepcounter{theorem}\framebox{\textbf{Theorem \thesection.\thetheorem}}} \begin{document}...
0
votes
0answers
14 views

Labelling and Referencing Multiple Custom Counters [duplicate]

I'm trying to label the custom counters at the end so I can refer to them later on in the document. \newcounter{theorem}[section] \newcommand\theorem{\stepcounter{theorem}\framebox{\textbf{Theorem \...
1
vote
2answers
61 views

How to define reference label and caption name in 'duplicated' environment?

I want to define a new environment that is very similar to the longtable environment, therefore I tried the following: \documentclass{report} \usepackage{caption} \usepackage{longtable} \usepackage{...
1
vote
0answers
43 views

Counter for version of document

I am trying to create a version counter of the document, to indicate which version the user is reading. Based on this answer: Add version number to document from file I managed to create this counter....
1
vote
1answer
22 views

Auto-completion of \ref doesn't work for my counter

I defined a counter and a command that defines examples and labels them. Unfortunately, when I use these definitions the \ref is not autocompleted by the texmaker or sharelatex. What should I add in ...
0
votes
1answer
27 views

Circumvent missing dot in hierarchical listing numbering

I'm trying to deal with the same problem as described here. But the accepted answer does not really help in my case since the problem occurs when I try to add hierarchical numbering to listings and I ...
1
vote
2answers
75 views

Reference to a counter [duplicate]

Certainly a stupid question. I have a newcounter defined normaly, that is \newcounter{sharc} How can I call a specific value of this counter with a command like label/ref ? Exemple blabla `\...
0
votes
1answer
21 views

Changing the numbering in Chemnum

How do can you change the numbering in the chemnum package? I would like to start from 100 rather than 1 for chapter 1. Then start from 200 for chapter 2 etc.
3
votes
1answer
88 views

How can I prevent \ifnum to be ignored?

So I have the following code: \newcount\x\x\i \ifnum\x<3 \advance\x1 \fi \the\x \bye which I call from the command line with pdftex '\def\i{9}\input test.tex' This puts out 10 (or \i + 1), ...
0
votes
0answers
25 views

How to set counter to appendix

I need to have both appendix and anexx in my document, so I did the following on my main: \appendix \include{appendix1} %%\include{appendix2} \include{appendix3} \renewcommand{\appendixname}{Annex} ...
3
votes
3answers
226 views

Strange combined behavior of newcounter and newcommand

I have very simple document, where I declare a counter and wand to add bold text for each list item as follow: \documentclass[11pt]{article} \usepackage{vmargin} \usepackage{graphicx} \usepackage{...
2
votes
1answer
26 views

pageref to part gives wrong page number

I have a \pageref pointing to a label for a \part (\label{part:publications}), but the number, that pageref spits out is off-by-one. If I have the following: Page: \pageref{part:publications} ... \...
2
votes
2answers
42 views

How to use `refcount` for chapter-wise counters?

I'm using the refcount package to set some counters to the same values as counters from another .tex file. The labels from the other .tex file are imported with the zref-xr package. This method fails ...
0
votes
0answers
39 views

Latest MacTex install will not compile old 'tex' files that used to work? [duplicate]

Now Using MacTeX-2018 Getting this error: ! LaTeX Error: Command \counterwithout already defined. Or name \end... illegal, see p.192 of the manual. Found this solution, on stack ...
3
votes
1answer
23 views

Using different counter for Index (makeidx)

I have a question similar to this question: I'm using makeidx and I want the index to use a different counter than \thepage. My code looks like this: \documentclass{scrbook} \usepackage{makeidx} \...
1
vote
1answer
15 views

Claim counter, destination with same identifier

I am getting warnings regarding my claims and claim proofs along the lines of: pdfTeX warning (ext4): destination with the same identifier (name{claimcount.1}) has been already use d, ...
2
votes
1answer
41 views

Change how lemmas are counted in the appendix using `newcommand`

I use the following command to count Lemmas in my paper. \newcounter{lcount} \newcommand{\lem}[2]{\refstepcounter{lcount}\label{#1}\vspace*{0.5cm}\noindent \textbf{Lemma \thelcount.}\ \ {#2}\vspace*{...
1
vote
1answer
102 views

How can expand a counter of auxiliary file and save in list with xparse?

I am using the modification of a macro to save to lists using expl3 and xparse. I have managed to create a small interface type [key = val] and using the environ package I have been able to achieve my ...
1
vote
0answers
38 views

counters, newcount and pgfcalendar, macros

I am trying to use the pdfcalendar library, but I think I'm confused by the definitions. My Question: What kind of LaTeX counter/macro/variable can I use with pgfcalendar functions? Do I have to ...
1
vote
1answer
41 views

How can I get the max height of a group boxes in an environment without incrementing a counter?

Here I use three macros \a, \b, \c which are captured into \BODY. I measure the height of \BODY and set the height \nodeboxht register to its result. This ensure the height of all boxes match the ...
1
vote
1answer
25 views

\refstepcounter does not print the counter

So I am trying to automate a counter using new counter and \refstepcounter. However I would like to print the number of the counter and the code below does not seem to word. Any idea why? \newcounter{...
5
votes
2answers
226 views

Change the color of a counter number

I have created a special environment (called 'psalm') that splits the text into verses, formats them, and enumerates them. I would like to also make the numbers of the verses appear in \textcolor{...
0
votes
1answer
52 views

How to count a newenvironment call

I use a newenvironment to structure my list of symbols and list of abbreviations. In some documents there is only one of them. So I try to count the use of this environment to correct the offset in ...
0
votes
2answers
42 views

Changing the “Appendices counter” from \alph to \arabic

I am trying to get the "Chapter number" in the \begin{appendices} to be a number instead of a Letter. Since I need 2 appendice chapters, one called appendix and one called "Bilag", where Appendix ...
0
votes
0answers
43 views

Counting Items in a Listings Environment

Fairly new to the listings package so bear with me please. I want to make a custom listing where the counter for it will not include the listings with no caption. The script below will add to the ...
1
vote
1answer
23 views

Make algorithm2e use existing counter

algorithm2e provides no option to use e.g. the subsection counter to number the algorithms. It only provides an option to create a new counter within e.g. the section counter. This counter will then ...
2
votes
1answer
38 views

Checking a command with \equal and then using that command for another command?

I am trying to check the definition of a command (either arabic, roman, Roman, Alph etc.) and from this information change the formatting of section titles, while making use of the command definition ...
0
votes
0answers
31 views

setting counter for theorem and lemma in mdframed

I am trying to set counter for theorems and lemmas, here is my codes \documentclass{tufte-handout} \usepackage[utf8]{inputenc} \usepackage{mdframed} % Framed Theorems \usepackage[usenames,dvipsnames]...
1
vote
1answer
42 views

How to add a visual counter in the header of each beamer slide?

I want to add a visual counter in the header of each slide using beamer, I attached a photo which indicates what I want to happen. Also, I want to add a number inside the circle, indicating the ...
0
votes
2answers
38 views

How to reset a counter to at 1 at each start of chapter?

I want the numbering of definition, lemma and theorem has the form x.y,where x is the chapter and y represents the natural order 1,2,3...I use a counter for the value of y.Here is my code, but ...
2
votes
2answers
41 views

Continuing an earlier theorem-like environment with amsthm & thmtools

When using amsthm, I want to be able to continue a particular theorem-like environment (in my case, an example) later. The continued environment should have the same number as the one it continues ...
1
vote
1answer
56 views

How to read a counter register from a file in Plain TeX?

I am a TeX user, and I would like to read a number from an auxiliary file in order to achieve things like: printing at the footing "page number X out of Total". I was trying to use the primitives ...
2
votes
1answer
46 views

Section counter fails in table of content. (Put all as 0)

Why the counter (\arabic{section}) put all sections as 0 in table of contents? Here my MWE: \documentclass[10pt]{book} \usepackage{fontspec} \usepackage{titlesec} \usepackage{lipsum} \renewcommand\...
1
vote
1answer
30 views

Skipping Numbers Using a Counter

I have several counters in my document, defined as follows: \newcounter{koala} \newcommand*\koala[1][]{\refstepcounter{koala}\textbf{\thekoala #1} } \setcounter{koala}{0} I know that I can start the ...
2
votes
1answer
50 views

counters of \declaretheorem and \newtheorem differ

I want to use thmtools in order to state questions, that I want to repeat at a latter point of my text. I declared the question-environment using \declaretheorem, but I also use theorem-environments ...
-1
votes
1answer
35 views

add counter to tcbset beamer

I have defined a tcbset as follows: \tcbset{% left=6mm, right=6mm, top=6mm, bottom=6mm, middle=4mm, } \tcbset{% outerlayer/.style={% enhanced, sharpish corners=all, colbacktitle=dcol,...
2
votes
2answers
58 views

Use counters in a bar chart

I have a document consisting of different topics within multi-variable calculus. I want to start the document with a bar chart displaying how many problems there are of each kind, based on the number ...
1
vote
0answers
53 views

Use a counter as label

I want to set the value of a counter as a label. I have the following structure: \section{First Section} Some text \subsection{First Subsection} Text again \subsection{Second Subsection} ...
1
vote
1answer
58 views

create \newtcolorbox with multiple options not working

I would like to create an advanced \newtcolorbox with multiple options and an auto counter but can't get it to work... The MWE is: \documentclass[11pt,a4paper]{article} \usepackage{lmodern} \...
4
votes
2answers
214 views

Dot between chapter number and figure number disapear after update

After a recent update the dot between chapter numbers and figure numbers disappeared. Here is a minimal example. \documentclass[]{memoir} \begin{document} \frontmatter Some text \mainmatter \chapter{...
1
vote
1answer
40 views

How to set up section, subsection and subsubsection counters correctly?

I used code from here. But I can't still manage it correctly. My code: \documentclass{scrartcl} \renewcommand\thesection{} \renewcommand*\thesubsection{\arabic{subsection}} \renewcommand*\...