2022 Developer Survey is open! Take survey.

Questions tagged [counters]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
45 views

I would like to insert a counter inside an index in LaTeX

This is my first question on Stackexchange, please apologize if I am too naive! In my lecture notes, I am inserting exercises in the text. They have a specific counter, say \ExoCounter. I am using a ...
user avatar
0 votes
1 answer
31 views

How to read counter value from every section

I'm trying to read a counter value for a specific section. For example \documentclass{article} \usepackage{amsmath} \newcounter{M}[section] \numberwithin{M}{section} \newcommand{\foo}{\refstepcounter{...
user avatar
0 votes
1 answer
30 views

save a counter to the aux file and read it later

I would like to write a counter to the aux file and then read it back when compiling the tex file for the second time. Basically, I am trying to write a command that has the same logic as the LastPage ...
user avatar
0 votes
1 answer
23 views

Get beginning and ending counter of environment in page

Let's say I have an environment theorem. And on top of each page, I want to print Theorems 1-3 so I would need to know how to access the starting and ending counter of the environment theorem. How ...
user avatar
  • 757
0 votes
0 answers
24 views

Subcounter (Korollar, Beispiel(=Example), Bemerkung(=Remark) it is german) does not reset, when creating new Theorem, Satz etc

I have this environments: \theoremstyle{definition} \newtheorem{definition}{Definition}[section] \theoremstyle{remark} \newtheorem{bemerkungdefinition}{Bemerkung}[definition] \newtheorem{...
user avatar
2 votes
1 answer
45 views

How to extract the counter value for each section separately?

\documentclass[a4paper, 12pt]{article} %%% Main drive for pdflatex %% \usepackage{amsmath,amssymb} \usepackage{enumerate} \usepackage[flushleft]{paralist}[2013/06/09] \usepackage{pgffor} % \foreach \n ...
user avatar
  • 489
1 vote
1 answer
42 views

Counting pages within certain chapters or sections of a book class document

Problem: For a document I need to submit to my university, the word count is unimportant but the page count is required to be equal to or less than a certain value (32 in this case). In the executive ...
user avatar
0 votes
1 answer
52 views

How to reduce one counter

In bellow MWE, the excoutP is added to store the value of excout. How can we only use the counter excout? Thank you in advance! \documentclass{article} \usepackage{etoolbox} \usepackage{xcolor} \...
user avatar
0 votes
0 answers
16 views

Add Custom Theorem Number Between Two Theorems

I hope this question is not a duplicate, I found many questions regarding theorem numbering in amsthm but none that addressed this problem. I'm writing down handwritten lecture notes in LaTeX using an ...
user avatar
  • 101
0 votes
1 answer
35 views

How to store current counter in collect file

I want to store the number of Exam in collect environment. The counter is alway store with final value. PLease help me correct my code with collect package. Thank you in advance! \documentclass{...
user avatar
1 vote
1 answer
71 views

Prevent reset of subsection counters in unnumbered sections in KOMA-Script

I'm using scrartcl and trying to mix and match numbered and unnumbered sections and sub-sections. It appears that in scrartcl the unnumbered variants of \section still reset the counters for \...
user avatar
  • 13
0 votes
1 answer
50 views

Count total marks and questions

I'm trying to calculate the total number of questions and total marks based on an exam paper I'm currently writing. My MEW: \documentclass[10pt]{exam} \begin{document} \section*{Section 1} This ...
user avatar
1 vote
2 answers
66 views

latex if condition showing up

I have a latex template which auto generates a table of contents (my university made this template). They have since changed their formatting requirements but won't offer help in updating the template....
user avatar
3 votes
1 answer
36 views

Non integer number in setcounter (report document): \setcounter{figure}{1.14}

I'm wondering how to write a non integer number inside the setcounter command. I'm writing a report so the numbers of the figures are not 1, 2, 3, but 1.1, 1.2, 1.3 (in chapter 1). I tried the command ...
user avatar
1 vote
1 answer
58 views

How to get the right page number in the first paragraph of a page?

I have defined a \figref command so that it refers to a labeled figure and gives the page number where the figure is located, unless the figure is on the same page where it is referred to (in which ...
user avatar
  • 437
0 votes
1 answer
30 views

use tex counters in tikz code

while trying to write some commands to simplify generating time lines with tikz, I stumbled over this error: MWE: \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{...
user avatar
  • 393
0 votes
0 answers
8 views

Hide counter number for single environment

In my preambles, I've defined "Claim" and "Proof of claim" environments so that these are automatically numbered in a coherent fashion. Also, the relevant counter resets after ...
user avatar
2 votes
2 answers
60 views

refstepcounter inside description item

My purpose is to create visual steps in proofs. I cooked this from the environment description: \documentclass{article} \newcounter{subproofcount} \newcommand{\thesubproffcount}{\arabic{subproofcount}...
user avatar
3 votes
1 answer
55 views

siunitx: Adding commas when printing a variable

I have an itemized list which adds numbers to a counter. At the top (after you compile it twice) it prints the total sum. It works correctly but I am trying to add commas to the sum, so it will print &...
user avatar
0 votes
3 answers
80 views

Numbering quotations

I want to create a new environment nquote based on displayquote (form csquotes package) that I can number, and display that number on the side so I can cite quotations in my document, like you can do ...
user avatar
  • 307
1 vote
1 answer
37 views

Showing theorems with a given number

I need to write up solutions (in LaTeX) for the problems which our instructor will give throughout the course. In order to do that I created an environment called prob (see below). Basically, it is a ...
user avatar
  • 279
1 vote
1 answer
46 views

Problems with newcommand and counter for filling a longtable

I am trying to create a form for orders. The heart of this document is a srclttr2 with a longtable to even get a nice document for long orders. To make this template more flexible/easy I would like to ...
user avatar
  • 11
3 votes
2 answers
141 views

Getting the absolute value of a counter

I'm trying to get the absolute value of a counter, but couldn't find anything online and can't seem to come up with a solution myself. The goal is not to get absolute value symbols (there is plenty to ...
user avatar
  • 33
1 vote
2 answers
59 views

Use counter with tcolorbox : Tcbincludegraphics with tcbcounter

I am writing a paper for my college and I use the tcolorbox package. What I am trying to do is using simultaneously the tcbincludegraphics but with the tcbcounter, and not another counter. I want to ...
user avatar
  • 43
2 votes
3 answers
174 views

How do you apply \Roman to a math expression in a counter?

Let's say I want to produce the same effect as in How do you switch numbers in a chapter? but with Roman numerals. So I would have Chapter I Chapter II Chapter III+IV Chapter VI instead of the ...
user avatar
2 votes
1 answer
35 views

"already defined" error within mdframed

Here is a custom theorem environment that utilizes mdframed: \documentclass{article} \usepackage[margin=1in]{geometry} \usepackage[framemethod=tikz]{mdframed} \usepackage{ifthen} %theorembox style \...
user avatar
0 votes
1 answer
40 views

Search for a word inside a macro using expl3

The title of this question refers to words in a general sense but in my particular case I'm searching for numbers inside a previously defined macro. In that macro I have only numbers separated by ...
user avatar
1 vote
1 answer
73 views

Enumerate setcounter

I want my list to look like: 1. 2. 3-6. 7. I tried: \begin{enumerate} \item \item \item[3-6] \setcounter{enumerate}{7} \item \end{enumerate} Which result in an error. How can I ...
user avatar
  • 115
3 votes
4 answers
215 views

How to iterate through macro parameters in a for loop? or how to expand a macro parameter with a counter?

I'm trying to expand a macro argument with a counter inside a for loop with the next code: \documentclass{article} \usepackage{xparse} \usepackage{forloop} \NewDocumentCommand\test{m O{II} O{III} O{...
user avatar
0 votes
1 answer
41 views

Spacing by a calculated value with a counter

I want to create an oblique table of content, my strategy has been so far to do the following: \newcounter{agendacount} \setcounter{agendacount}{0} \setbeamertemplate{section in toc}{% \hspace{-0....
user avatar
  • 101
1 vote
0 answers
59 views

Biblatex labelprefix with counter

I am writing a proposal and I need to split my bibliography into (1) own published papers, (2) own unpublished papers, and (3) other references Parts (1) and (2) are limited to 10 references and I ...
user avatar
  • 11
0 votes
1 answer
27 views

environment with an optional argument relating to counter

This question is on the basis of my last question: Define own class options relating to counter. With the help of egreg, here is a class file in which there is an environment named exercise: \...
user avatar
  • 343
0 votes
0 answers
28 views

Counting items printbibliography would print after filters, categories, or keywords

I want to typeset my CV and include a list of publications and talks. I use biblatex and multiple bibresources for managing them. I use printbibliography several times to print a list of papers, talks,...
user avatar
1 vote
0 answers
21 views

Adding Equation number to multline* equation

Currently my report has multiple equations, some of which require using the multline function. Is there a way to continue the equation numbering used when using {equation} on to equations using {...
user avatar
  • 11
1 vote
1 answer
20 views

Hyperlink to supplemental Figure S1 links to Figure 1. How to make a new set of links?

I have supplemental material, which should have its own set of figures, equations, etc. These can be numbered correctly by resetting the figure counter and adding "S" to the label. However,...
user avatar
2 votes
0 answers
18 views

Change the "row index counter" at pgfplotstable

Is it possible to change the "row index counter" (locally) at pgfplotstable. Maybe as a style? As a test example: I skipped some rows in the second table. If the "row index counter&...
user avatar
  • 6,217
1 vote
1 answer
92 views

Format verses with incrementing counters

How can I format verses with a counter assigned to them? I am working on a book that requires formatting verses (in Devanagari and Roman transliteration) in a specific way. Please see the image below ...
user avatar
1 vote
1 answer
41 views

Increment Counter in Section Title

I wonder why I can not call \stepcounter within a section title. For example, this code works fine: \documentclass{article} \newcounter{mycounter} \begin{document} \section{Title \themycounter} \...
user avatar
  • 207
1 vote
1 answer
83 views

Quiz with answer (please recommend me a format of TeX document)

I want to make a quiz using TeX that "looks like" Problem 1) Let $f(x)=x^2$. Evaluate $f'(1)$. Problem 2) Let $A$ be a matrix such that $$A=\begin{bmatrix}3&1\0&1\end{bmatrix}$$ ...
user avatar
0 votes
0 answers
60 views

What is the use of \romannumeral0?

I understand \romannumeralk when k is positive. However, I have seen \romannumeral0 in a few codes but I do not understand its use. What is it? Example: \romannumeral0\expandafter\xintzapspaces\...
user avatar
  • 189
2 votes
1 answer
52 views

item counter within enumerate

I want to customize items from a list within the enumerate environment, using a counter that is followed up in each list. Here's how I did it: \documentclass{article} \usepackage{enumitem} \begin{...
user avatar
  • 23
4 votes
0 answers
80 views

Difference between counters and tokens in TeX

This is my first question here on TeXSE, and my second question on the StackExchange community. I am reading Notes on Programming in TeX by Dr. Christian Feuersänger as part of a general introduction ...
user avatar
0 votes
0 answers
38 views

Update counter using xparse command with argument processing

I recently started using xparse and I want to update the value of a counter with the output of an xparse command. The xparse command uses argument processing which seems to pose a problem. Example ...
user avatar
1 vote
1 answer
60 views

Enumerate examples

I want to be able to keep track of numbered examples throughout chapters/sections, something like \section{<name>} or maybe an environment would work better. So I could have something like or ...
user avatar
4 votes
1 answer
159 views

Fix total number of pages in beamer

I am working on a beamer file that has a a lot of slides as an "appendix". Hence, when I introduce the command \setbeamertemplate{footline}[frame number] to display the page progress in the ...
user avatar
0 votes
0 answers
30 views

Even pages on two-sided document on right - setcounter problem?

I have a two-sided document, where the table of contents (TOC) is in Roman numbering. Afterwards I use Arabic numbering for the main part, and afterwards Roman numbering for the bibliography (BIB) ...
user avatar
  • 91
0 votes
0 answers
24 views

how to add a user-defined counter in displayed math mode [duplicate]

I want to use a user-defined counter in displayed math mode, and to cross-reference them. When I don't add amsmath package, things went well: \documentclass{article} % \usepackage{amsmath} \newcounter{...
user avatar
  • 1,119
1 vote
1 answer
43 views

A problem of counters, timing and etoolbox

I am attempting a format for recipes. For input, each step of the method is accompanied by the ingredients for that step. The output places all of the ingredients together, and all of the steps of the ...
user avatar
  • 7,683
2 votes
1 answer
65 views

Problems and Solutions with deferred printing

I'm texing my university lecture notes and want to include some problems with solutions in the document. What I want: While all other amsthm environments are consecutively numbered Definition 1.1, ...
user avatar
1 vote
1 answer
33 views

Create a slide counter per section

Is there a way in beamer to have a counter of slides that resets with every section (in addition to the global counter that does not reset with sections)? See below for a MWE \documentclass{beamer} \...
user avatar
  • 1,531

1
2 3 4 5
26