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

Questions tagged [counters]

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

4
votes
5answers
85 views

How can I access and store the current value of a counter?

My counter is being updated by a command and I want to save the current value + 1 of this counter at a specific point so that later on I am able to print it out. \newcounter{counterA} \newcounter{...
0
votes
0answers
43 views

Can Even Pages Be Right Pages?

SETCOUNTER in BOOK changes page numbers as well as directions—odd pages are right pages and vice versa. This is an example. \documentclass{book} \title{TEXT} \author{TEXT} \date{TEXT} \begin{document}...
0
votes
2answers
36 views

Exclude numerals from a custom counter environment

I have my document set up so that examples are numbered but I would prefer to be able to add my own number or title. I know I can add the title in square brackets, but how do I remove the numbers? ...
1
vote
1answer
43 views

Need LaTeX to automatically update a reference number within a table

I'm need to assign a reference number inside a table such that it automatically updates the number at the end and restarts the counter when the initial part of the reference number changes. For ...
5
votes
1answer
395 views

What does the asterisk (*) do in \arabic*?

I was wondering what the '*' (asterisk) does in the command \arabic*? My code: \usepackage[inline]{enumitem} \begin{enumerate*}[label=\textbf{\arabic*})] \item Text 1 \item Text 2 \item ...
2
votes
1answer
37 views

How to define counter for problems and examples of a text?

This is the first time that I'm going to prepare a book with Latex. I am not so familiar with advanced options of Latex, and in particular with typography. The book includes a lot of examples and ...
2
votes
1answer
30 views

Set the counter for multiple equations of the same kind

I want equations (2) and (3) to be labeled as (1a) and (1b) \documentclass[12pt,a4paper,table,usenames, dvipsnames]{book} \usepackage[table]{xcolor} \definecolor{def}{RGB}{66,103,178} \usepackage{...
7
votes
5answers
177 views

Loop over an optional argument

I'd like to use the command \foo with an optional argument to step and print the counter value iterated according to the number passed. So, for example, \foo[5] should step the counter 5 times, one ...
0
votes
0answers
32 views

How do I reset the setcounter for a custom lstlistingname in latex?

I am fairly new to the world of LaTeX and am currently working on a report. Throughout the report there are several tables, figures and commands. For the figures and tables I found the working code ...
2
votes
1answer
34 views

Problem with condition in a table by using counters

I'm trying to make a conditional dynamic table that uses counter for comparison but i got a irrational error, Please see the following code: % !TEX TS-program = xelatex \documentclass[hidelinks]{...
1
vote
1answer
126 views

The construction of Rooty helix, code explanation

Could someone please explain some parts of this code? I'm newbie on LaTeX and could not understand some parts. What does this \foreach \y in {86,38,15} means? Could you explain with details what is ...
4
votes
3answers
70 views

Custom numbering style using the number of Symbols instead of Numbers

Is there any possible way to count by the number of a symbol ? For instant, if I want to print 4 versions of a letter, I assigned \arabic{#1} numbers which shows: 1 2 3 4 What I want is to ...
5
votes
2answers
216 views

How to do calculations with a LaTeX counter in a newtcolorbox environment?

I created a course summary box. In order to distinguish the summaries by school year, I have put an optional argument that displays the latter in the upper left corner (highlighted in yellow on the ...
0
votes
1answer
44 views

mcexam a custom type question

I'm trying to create an exam using the code provided by him. Here is the code: \documentclass[twoside]{article} \usepackage[english]{babel} % set fonts \usepackage[utf8]{inputenc} \usepackage[T1]{...
0
votes
0answers
31 views

Custom counter for oddside and evenside margins

When using the twoside in the article class, resetting the page counter creates an issue in regards to the odd and even side margins. Is it possible to declare a custom counter that article considers ...
2
votes
3answers
65 views

Use of \p@COUNTER

When a new counter is defined via \newcounter, e.g. \newcounter{mycounter} then a command \p@mycounter is also defined. I can see this again popping up when setting the \@currentlabel in \...
0
votes
1answer
22 views

Organize counter (newtheorem)

I'm writing some notes and I have a problem with the organization. I defined the theorems as follows: \documentclass[12pt,a4paper]{book} \theoremstyle{plain} \newtheorem{teo}{Teorema}[chapter] \...
3
votes
1answer
33 views

Use same reference count for lstlisting and figure/graphics

I have the following code on overleaf: \begin{lstlisting}[caption={Código inicial para o sistema de arquivos},label={lst:Figura1}] abstract sig FSObject { } sig File, Dir extends FSObject { } sig ...
0
votes
2answers
59 views

beamer: finding out if there is content in the appendix

I am trying to determine if there are pages in the appendix. If there are I want to show a separation page/frame as indicator but in the handout mode only. In my current setup (due to some ...
1
vote
1answer
52 views

Removing an additional Counter from Table of contents

I have created two custom counters scireq and scisubreq as I'm working on a document specifying requirements and couldn't find any requirements package. Unfortunately, the requirements come up in the ...
2
votes
1answer
73 views

Using exam question counter as an argument

I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document. I would like to have the answers automatically labeled by question ...
2
votes
1answer
34 views

How to define two labels inside an environment to compute the number of pages the environment spans?

I would like to count the number of pages that a certain environment (named myenv) spans. In principle, I set two labels, one in the beginning and one in the end of the environment. These labels ...
2
votes
1answer
63 views

How to display chapter/section counter value?

I'm building a \documentclass[...]{book} latex file. Each chapter has some sections. Each section has some exercises. The exercises are displayed on \exercise command. In the preamble I did: \...
2
votes
1answer
40 views

Global counter as argument

I am in a need of a global counter which I can be used as argument to a method. When it is used as an argument, I just want the current value of it... so what the method receives is a number, not the ...
2
votes
1answer
81 views

Accessing the current frame number in beamer

I know how to manually reset the page counter using a fix value. In the MWE below this fix value 0. Now I wonder how to use a variable value like \framenumber - 1. In this question it was asked for ...
0
votes
2answers
34 views

multiple section contexts in document which each has its own counter

I try to create a latex template for a homework where I need two section counters running parallel. I have an example here: As you can see I'd like to separate the main article from the ...
3
votes
2answers
212 views

Convert all counters to base 6

Is it possible to change the numeration base of LaTeX? Actually I am looking for base 6. I would like this change to apply to all counters (TOC, pages, chapters..). I found this topic How can I make ...
2
votes
1answer
30 views

The name of a cleveref reference is missing when the reference is inside a subsubsection of an appendix

The following KOMA-Script/LuaLaTeX document: \documentclass{scrbook} \usepackage[nameinlink]{cleveref} \setcounter{secnumdepth}{4} \begin{document} \appendix \chapter{Chapter} \section{Section} \...
3
votes
1answer
38 views

Changing listing numbers

I want to change the numbers of a listing based on certain rules: Line 10: no number Line 11 onwards: the number that corresponds to the line+5 The displayed numbers should thus be: 1, 2, 3, 4, 5, 6,...
3
votes
1answer
82 views

ConTeXt passing current counter value to lua

I've been experimenting with ConTeXt and have been trying to create an exam using it. I would like to have an array in lua that holds the weight of each question, and a custom enumeration called "...
8
votes
3answers
296 views

Use counters value after it appears in the code

Is there a way to use a counters value at one point in the code, but with the counters state of a line, that comes somewhat after the corresponding use of the counters value? E.g. Define the counter ...
2
votes
1answer
97 views

section with letters automaticaly creates dots after letter

I wanted to change the enumeration of subsections from arabic numbers to roman character, so I used \renewcommand\thesubsection{\thesection.\alph{subsection})} For some reason I can't figure out ...
2
votes
2answers
42 views

Properly setting \thecounter when defining \newcounter{counter}[resetwith]

With \newcounter{counter}[resetwith], I can define a counter to be automatically reset when resetwith changes. However, it seems that \thecounter is defined to just display the value of counter, and ...
2
votes
1answer
56 views

Continue previous page numbering (Roman/Arabic) with two independent counters?

Assumed I want to write a document with abstract, acknowledgements, three chapters, two appendices and a statutory declaration. Hereby... Abstract and acknowledgement should be numbered in Roman ...
0
votes
1answer
46 views

Counter reset for numbering the figure

In my chapter, I have several sections. How can I reset the counter of figures for each section? i.e. In chapter 1, section 1, My figures should be numbered 1,2,3 (instead of 1.1, 1.2, 1.3). In ...
2
votes
1answer
29 views

Alphabetic Footnote Marks that (automatically) omit the letters 'j' and 'w'

I am trying to duplicate the footnote style from a book where the footnote marks are the letters of the alphabet—but the footnote omits the letters 'j' and 'w'. The kludge I have worked out involves ...
1
vote
1answer
28 views

Alphabetic Footnote Marks to 'roll over' from 'z' to 'a' automatically

How do I make the footnote counter automatically reset to 0 whenever it reaches 25? I am trying to duplicate the footnote style from a book where the footnote marks are the letters of the alphabet--...
1
vote
1answer
39 views

Downcounter in moderncv

I use my counter in moderncv.cls as \documentclass{moderncv} \newcommand{\NbOfJournalPub}{10} \newcounter{MyCounter} \setcounter{MyCounter}{-1} \newcommand*{\myJlistitem}{\stepcounter{MyCounter}[J\...
1
vote
1answer
28 views

How to ref the counter in the command AlgHeader?

First, a counter AlgCounter is defined. Second, a new command \AlgNo is defined and the counter AlgCounter is used in the definition of \AlgNo. Third, in order to draw three lines of an algorithm, a ...
4
votes
3answers
147 views

How to resume enumi in a question of exsheets?

I can resume by adding \setcounter{enumi}{\thetemp} before the first item \setcounter{temp}{\theenumi} after the last item where temp is my new counter. However this approach does not look elegant. I ...
1
vote
1answer
55 views

Using the same numbering in two different {chapter*}

I'm currently writting my thesis and I have to record two introductions (environment \chapter*) : one in French and one in English. Since the informations and equations are exactly the same, I would ...
2
votes
2answers
50 views

How to get to total number of lines in an environment

While trying to figure a complete answer to this post, I was wondering how I could get the total amount of lines in the algorithmic environment. Of course this question can be relevant for other ...
0
votes
1answer
47 views

Special section names and counter in memoir with cleveref

I'm trying to have separately numbered "Resource" sections in a memoir document, but have produced clevereferences that refer to the "current" Resource counter value instead of the referenced Resource'...
3
votes
1answer
40 views

Calculations in pstricks swallows the spaces after a command [duplicate]

The following MWE works fine when plotting a square using pstricks with xelatex. \documentclass{article} \usepackage{pstricks} \begin{document} \def\x{0 } % Notice that there MUST be a white ...
2
votes
1answer
141 views

Total number of frames in subsubsection?

I would like to know if there is an easy way to get the total number of frames within a subsubsection in Beamer ? I already managed to get the frame count in each subsubsection, as can be seen in the ...
1
vote
2answers
29 views

Show chapter number along with Total Chapter Count in Chapter title - Memoir document class

How to show chapterNo/TotalChapterCount in the Chapter title of memoir document. \documentclass{memoir} \usepackage{lipsum} \begin{document} \tableofcontents \chapter{First} \lipsum ...
1
vote
1answer
44 views

Use counter value from given label

I have defined two new counters and two macros. The first macro \requirement simply increases the counter requirement. The second macro \subrequirement is basically doing the same but using requriment ...
3
votes
3answers
44 views

Execute condition in “last” environment typeset of it's type

I am trying to write some code that will clean up some future notes for me. In essence I want to be able to "turn on" or "turn off" an environment (proofs of results) via a simple command. I managed ...
3
votes
3answers
77 views

A command for arbitrary constants

When proving theorem, I sometimes define arbitrary constants that I then reference. These constants are not really important and they do not need to be memorable beyond the proof. This is why I ...
2
votes
1answer
31 views

How do I add graphicname like figurename?

MWE \documentclass[a4paper,11pt]{book} \usepackage{caption} \usepackage{tikz} \usepackage{graphicx} \usepackage{float} \newfloat{Grafik}{htbp}{loa} \begin{document} \chapter{A} \section{B} \begin{...