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}.

0
votes
0answers
25 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
56 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
18 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
31 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
45 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
45 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
54 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
33 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
26 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
36 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
39 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
32 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
210 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
22 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
33 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,...
0
votes
0answers
25 views

Memoir class problem

I can't run even the most minimal example with the memoir class: \documentclass{memoir} \begin{document} bla, bla.... \end{document} I get the following error message: Command \counterwithout ...
2
votes
1answer
62 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
294 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
84 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
36 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
49 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
31 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
28 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
27 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
37 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
26 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
143 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
46 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
43 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
38 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
121 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
39 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
76 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{...
1
vote
1answer
22 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
71 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
929 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
299 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
43 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
40 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
234 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
46 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
28 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
31 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
21 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
67 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
49 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....