# Tag Info

11

TeX has a fixed number (256 in classic TeX 32768 in etex and xetex and 65536 in luatex) of registers which store integer values. \newcount\c allocates the name \c to one of these registers, and classic TeX primitives like \advance operate on them, note that addition here involves assignment back to the register so it is not an expandable operation. LaTeX's ...

9

You can set the number by hand; since it's a second level list, you have to set enumii. \documentclass[14pt,a4paper,headlines=6,headinclude=true]{scrartcl} \usepackage{amsmath,amssymb,stmaryrd} \usepackage{paralist} \usepackage{tabto} \begin{document} \begin{enumerate} \item \textbf{Working with ...

7

There are two \newcounter calls inside the macro \pichart. When the macro is called the second time, then the counters are already defined and you get the error messages about already defined commands \c@a and \c@b, which are the internal command representation of the counters. Move the \newcounter calls outside and reset the counters inside the macro: ...

5

Since calc redefines \setcounter, \stepcounter and \addtocounter, the only way you have if you want to keep your settings is to redeclare these definitions after loading amsmath. That is, add the following lines in your preamble after \usepackage{amsmath} \makeatletter \def\setcounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% ...

5

A quicker workaround, regardless which package is loaded first, is to use \numexpr from e-tex extensions (which should be available for basically any TeX distribution nowadays). It expands the values of the calculation before it's advance by \addtocounter In the following MWE the result is, as expected, 100 \documentclass{article} \newcounter{test} ...

5

Another version, using my assoccnt package, without the need of remembering the counter value: The contenumii counter is used to store the total value of the enumii counter automatically and stored back after inparaenum. Caveat: It will be incremented each time when another second level enumeration is used Use the \SuspendCounters feature from the ...

4

The user answering (How to remove chapter numbering without removing it from tableofcontents) the linked question wants to remove the chapter numbers there, but keep the section numbering 'consistent'. This can be achieved in the way the user did: Use \chapter* to prevent the chapter counter to be displayed, however, this does not increase or set the ...

4

You can't define counters while tabularx does its job. A solution may be to define the one you need in a tabularx beforehand, or do it in a delayed fashion using the .aux file. \documentclass{article} \usepackage{enumitem} \usepackage{etoolbox} \usepackage{booktabs} \usepackage{ltxtable} \usepackage{ltablex} \usepackage{cleveref} \makeatletter ...

3

As in the solutions by David Carlisle and egreg mentioned: counters should not be defined on-the-fly. I used a similar approach as David Carlisle, providing a \NewDocumentCounter, \DeclareRequirement, DeclareRequirements commands which can be used in preamble only, to prevent accidental usage. \documentclass{article} \usepackage{enumitem} ...

3

As Ulrike Fischer said: The counter would be incremented each compilation time, which is basically useless. Compilation will work even for an unchanged version, which should have the some version number then. However, this is the feature as requested: At the beginning of the document the counter is increased and at the end the current value is stored to ...

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

3

You should almost never declare a counter within a macro, it should be declared once in the preamble and just used. then tabularx would know about it and preserve its value when doing trial width settings. \documentclass{article} \usepackage{enumitem} \usepackage{cleveref} \usepackage{etoolbox} \usepackage{booktabs} \usepackage{ltxtable} ...

3

You should consider using advdate to advance dates: March 30, 2015 April 2, 2015 April 6, 2015 April 9, 2015 April 13, 2015 April 16, 2015 \documentclass{article} \usepackage{advdate} \newif\iffirst \newcommand{\pnext}{% \AdvanceDate[3]% Step 3 days ahead... \iffirst \AdvanceDate\global\firstfalse% ...maybe 4 \else ...

2

After studying the cleveref package documentation further, I stumbled across a warning in section 14.1 Non-bugs. Even though I did not use \label in an optional argument to another command (as the third bullet suggests), it seems that it should be enclosed with curly braces in order to work properly. Correcting \label[opC]{line:1} into {\label[opC]{line:1}} ...

2

The \setcounter{<counter>} doesn't reset the related counters. For every counter there is an associated list of counters that should be reset when the counter is stepped. Only the \stepcounter{<chapter>} command does the resetting (and \refstepcounter as well, because it calls the basic command). The shown code could be improved by removing one ...

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

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

If you need to print different value from each run of TeX, then you need to do: 1) read the value from file, 2) add the value, 3) save the value to the file. This can be done by elementary TeX tools (i.e. TeX primitives plus common macros) by this code: %% 0) declaration: \newread\verfilein \newwrite\verfileout \newcount\vernum %% 1) reading the file: ...

1

A 'dirty' workaround: Use a wrapper environment named Longtabu having the same parameters and say \addtocounter{table}{-1} in the environment end code, in conjunction with \caption*{}, which does not make an entry to the LoT. Small drawback A better setup would test, if the figure number is already larger than 0, otherwise this could lead to bad counter ...

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