Tag Info

Hot answers tagged

9

Edit The look-ahead - version of knowing section numbers per chapter in advance is at the very end of this post. It requires two runs of compilation. This question lead to a new package cntperchap which is available in its version 0.2 on CTAN since 2015/9/5 This uses the assoccnt package (whose author I accidentally know quite well ;-)) It ...


6

The following example lets increment the counter myCounter the usual way starting with 0, 1, 2. The latest value of the counter is stored in a zref label LastPage after the last page is shipped out. Then the appearance of the counter, \themyCounter is redefined to show the desired value by subtracting the actual value from the latest value: ...


5

You can use the totcount package to grab the final value of a counter and use that to set your starting value. \documentclass[12pt]{article} \usepackage{totcount} \newtotcounter{myCounter} \newcounter{myDcounter} \begin{document} \setcounter{myDcounter}{\totvalue{myCounter}} \addtocounter{myDcounter}{1} \addtocounter{myCounter}{1} ...


5

To change the table numbering to roman you just need to redefine the command \thetable which prints the table counter. So you make use of \Roman{<counter>}. For small letters you can use \roman{} instead (but it is ugly for captions). \documentclass[11pt,a4paper]{report} \renewcommand{\thetable}{\Roman{table}} \begin{document} ...


3

It's an expansion problem in \regtotcounter; I'll investigate whether it's possible to avoid the cumbersome code, but here's a working solution: \documentclass{article} \usepackage{multido,totcount} \multido{\i=1+1}{3}{% \begingroup\edef\x{\endgroup \noexpand\newtotcounter{compteurCh\romannumeral\i}% }\x } \begin{document} \thecompteurChi ...


3

\renewcommand\theequation{\arabic{equation}} In the intro then \renewcommand\theequation{\thesection.\arabic{equation}} at the end of the intro.


3

Your \listLength command doesn't work by pure expansion; you should say \newcommand*{\listLength}[1]{% \setcounter{listlength@cnt}{0}% \forcsvlist{\listlength@add}{#1}% } as the definition of \listLength and then \listLength{\@glo@types}% \addtocounter{mtc}{\value{listlength@cnt}}% in the code. There's a much slicker way with expl3: ...


2

This uses a temporary counter to store the section counter value before the first \input is used. In addition, the \input command is changed to \refstepcounter a input counter, which then resets the section counter in turn. Edit Automated storing of the section counter value for first \input. Some drawback: Each time if \input is used the section counter ...


2

Define an auxiliary counter and use it for temporary storage of the section number. Then use \inputreset{file} for inputting a file where you want to reset the equation number. However, you'll have big problems as soon as you try loading hyperref. \newcounter{storedsection} \newcommand{\inputreset}[1]{% \setcounter{storedsection}{\value{section}}% ...


2

One way is to change the table counter formatting command \thetable, which is very likely \thechapter.\arabic{table} to \arabic{table} only and reset to the old behaviour it after the relevant chapter. This can be with the \let saving mechanism. Some more explanation: The \newcounter command allows for an optional 2nd argument which contains the driver ...


2

Use the package chngcntr: In your preamble: \usepackage{chngcntr} In the Introduction section: \counterwithout{equation}{chapter} After the Introduction section: \counterwithin{equation}{chapter}


2

I don't see any real problem with your code. There is \newtotcounter that creates a counter and registers it with totcount in one go, which will save some coding. Here is a complete document showing it working. \documentclass{article} \usepackage{multido,totcount} \newcounter{AuxCounter} \renewcommand{\theAuxCounter}{\roman{AuxCounter}} ...


1

The following reproduces the problem: \documentclass{book} \renewcommand{\thechapter}{\thepart.\arabic{chapter}} \begin{document} \tableofcontents \chapter{A chapter} \section{A section} \end{document} Note that \thechapter is defined to include \thepart.. Also, the part counter is typically set using \Roman (as in ...


1

This gives you the ratio of the current page to total page number: \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \def\insertframeratio{% \pgfmathparse{\insertframenumber*100/\inserttotalframenumber}% \pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\% % } \def\insertpageratio{% ...


1

Redefine \thethm to not add the section number if it's 0. \documentclass[oneside, openany,12pt]{book} \usepackage{amsthm} \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] \theoremstyle{definition} \newtheorem{defn}[thm]{Definition} \renewcommand{\thethm}{% \ifnum\value{section}=0 \thechapter.% \else \thesection.% \fi \arabic{thm}% ...


1

There's no need to define a new counter: \documentclass[12pt]{report} \newtheorem{lem}{Lemma}[section] \newtheorem{eg}[lem]{Example} \newtheorem{pro}[lem]{Proof} \begin{document} \chapter{abc} \section{xyz} \begin{lem} asdf \end{lem} \begin{eg} fdsa \end{eg} \begin{pro} sdaf \end{pro} \end{document} The first \newtheorem sets up a new counter ...



Only top voted, non community-wiki answers of a minimum length are eligible