# Tag Info

## Hot answers tagged counters

13

You probably compiled the following minimal example: \documentclass{article} \begin{document} Hello World! \end{document} which provided the following (partial) .log: ... \c@part=\count79 \c@section=\count80 \c@subsection=\count81 \c@subsubsection=\count82 \c@paragraph=\count83 \c@subparagraph=\count84 \c@figure=\count85 \c@table=\count86 ... The above ...

7

You're taking the wrong approach; you just need to choose the appropriate font. \newcount\currentfontsize \currentfontsize=10 \font\ntxsyxii=ntxsy at 12pt \font\ntxsyxi=ntxsy at 11pt \font\ntxsyx=ntxsy at 10pt \font\ntxsyix=ntxsy at 9pt \font\ntxsyviii=ntxsy at 8pt \font\ntxsyvii=ntxsy at 7pt \font\ntxsyvi=ntxsy at 6pt \font\ntxsyv=ntxsy at 5pt ...

6

The back tick can be used to get the character code in numerical contexts: a or \a The numerical context can be provided by \number or the following example uses e-TeX's \numexpr for the subtraction. \documentclass{article} \newcommand*{\setcurrentlabel}[1]{\setcounter{enumi}{\numexpr#1-a\relax}} \begin{document} ...

4

The LaTeX team recently (start of 2015) integrated the fixltx2e package into the kernel. There are a small number of places where this may cause issues, primarily where people have relied on problematic behaviour. Here, the class is relying on the expansion safety of \thecounter (or rather of the code to make footnote symbols), which it should not do. The ...

4

This should work: \setcounter{equation}{66} after \chapter{...} since \chapter usually resets the equation counter. \documentclass{book} \begin{document} \setcounter{chapter}{7} \chapter{foo} % chapter steps to 8 and resets equation to 1 \setcounter{equation}{66} $$E = mc^2$$ \end{document}

4

Not every environment has a counter and even if it has got a counter, there is no guarantee that the counter has the same name like the environment (and vice versa). This uses \xpatchcmd{} to hack into \refstepcounter (which is the labelling one) and defines \mylabelvalue as \number\value{#1}, #1 being the counter name. It does not interfere with hyperref ...

4

hyperref overrules \ref, unless the new definition is in \AtBeginDocument egreg will strike me down for keeping xspace ;-) In addition: I doubt that \pageref{#1} will give a number at all, if it's inside the \ifthenelse expression. I used \getpagerefnumber from refcount which provides a number which can be used in calculations. Additionally, I shifted ...

4

A completely different approach should be taken. \font\twelvesy=cmsy10 at 12pt \font\elevensy=cmsy10 at 11pt %\font\tensy=cmsy10 at 10pt \font\eightsy=cmsy10 at 8pt % or rather =cmsy8 \newfam\bigsyfam %\def\bigsy{\fam\bigsyfam\twelvesy} \textfont \bigsyfam =\twelvesy \scriptfont \bigsyfam =\tensy \scriptscriptfont\bigsyfam =\eightsy ...

3

Rather than redefine \ref, you may want to look into loading the varioref package and using that package's \vref and \fullref macros. They basically do what your modified \ref macro does. If the hyperref package is loaded as well, with \fullref the figure number (e.g., "n") and the page number (e.g, "m") are separate hypertargets. With \vref, the entire ...

3

The following is a slightly different approach to Christian's. It creates an automated \label for each \ref in order to ensure that the page numbering will be accurate. \documentclass{article} \usepackage{lipsum}% Just for this example \usepackage{refcount,hyperref,graphicx} \newcounter{refcnt} \AtBeginDocument{% \let\oldref\ref ...

3

You should put \frametitle inside \task instead of the reverse. \documentclass{beamer} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage{ifthen} \usetheme{CambridgeUS} \newcounter{tasknumber} \stepcounter{tasknumber} \newcounter{taskletter} \resetcounteronoverlays{tasknumber} \resetcounteronoverlays{taskletter} \newcommand{\task}[1][ ...

3

This generates the counter on the fly although this is not recommended in any case. If the counter name given as first argument already exists, there is a command \c@#1 already which is LaTeX representation of a counter (well, top layer on \count.... registers actually. If \@undefined{c@#1} is true, define the new counter and set it to one, displaying ...

3

You don't want a new counter but a new representation. The shortcut from the tasks package are defined in the cntformats package, and its documentation describes how to add new ones: \documentclass{report} \usepackage{amsmath} \usepackage{tasks} \makeatletter \def\@mynum#1{\ifcase#1\or X\or Y\or Z\else ?\fi} \NewPatternFormat{m}{\@mynum} \makeatother ...

2

I propose another solution: use relative referencing (as described in the spreadtab manual), i.e., use sum(c2:[0,-1]) instead of sum(c1:c\thepos). (Note I exchanged c1 for c2 – c1 is the head of the column and the first number to be summed up to is in c2.) Using the table from your other question: \documentclass{article} \usepackage[T1]{fontenc} ...

1

It's Example*i: \documentclass{article} \usepackage{enumitem} \usepackage{xcolor} \newlist{Example}{enumerate}{2}% \setlist[Example]{label={\arabic*.}} \newlist{Example*}{enumerate*}{2}% \setlist[Example*]{itemjoin={\hspace*{2.0em}}, label={\arabic*.}} \begin{document} \textbf{Vertical List} \begin{Example} \item First V item. \item Second V ...

1

The proper syntax is \alph{partnum}, not \alph{\thepartnum}. I also show (in commented text) the use of \roman{partnum} or, in the style originally tried by the OP, \romannumeral\value{partnum}. This latter syntax is TeX, whereas the former two are LaTeX. EDIT to implement solution into \testquestionpart. \documentclass[12pt]{amsart}% ...

1

For the amount of effort to set the numeric label, you might just as well use the optional argument typically supported by \item: \documentclass{article} \usepackage{enumitem,xparse} \NewDocumentCommand{\fixeditem}{o}{% \IfNoValueTF{#1} {\item}% \fixeditem {\item[\scshape #1.]}% \fixeditem[..] } \newlist{subp}{enumerate}{1} ...

1

You have to set the footnote counter after \maketitle etc. Setting it to 0 in the document preamble (even before \maketitle) is useless, since \maketitle (better the setup of apa6) will increment it but it's not reset automatically after that. \documentclass[man,12pt]{apa6} \title{Title} \author{Author\footnote{Corresponding address}} ...

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