# Tag Info

12

With My Style/.style={draw=red, .code={\stepcounter{MyCounter}}}, your style My Style defines an unused blank key linked to your code. You may use : \tikzset{My Style/.style={draw=red,inc/.code={\stepcounter{MyCounter}},inc}} to define and use the inc key. Or you may use .code handler instead of .style handler: \tikzset{My Style/.code={\stepcounter{...

6

The last question how to use the section counter in conjunction with the equation counter: \renewcommand{\theequation}{\arabic{section}.\arabic{equation}} will print the equation number with the section number as prefix only, not the full nine yards with chapter.section.X. Now the more generic answer about the \thefoo - like commands. In principle such ...

5

zref's abspage module provides access to an "absolute page number" property. Together with the lastpage module, you can extract the last absolute page number using \zref[abspage]{LastPage}. Here is a minimal example: \documentclass{article} \usepackage[paper=a5paper]{geometry}% Just for this example \usepackage[abspage,user,lastpage]{zref} \begin{...

5

The package xassoccnt provides a mean to force a stepping of an associated counter each time a driver counter is stepped as well -- the driver counter is page here. This has an advantage over the totcount or lastpage packages, since the associated counter realpage (any name will do, but section etc. is unwise, of course ;-)) is not reset (unless explicitly ...

4

Here's a variant based on the preceding code, which should work in any environment and is compatible with cleveref: \documentclass{article} \usepackage{ebgaramond, ebgaramond-maths} \usepackage{chngcntr, mathtools,} \usepackage{framed, etoolbox, cleveref} \makeatletter \newcounter{framedeqn} \AtBeginEnvironment{framed}{\let\c@equation\c@framedeqn\def\...

4

There's no need for a whole new equation environment, only a fake counter has to be established which is used inside by saying \let\c@equation\c@fakeequation Remember, that \c@foo is the internal representation macro of the counter foo, so this means that unless specified otherwise all operations to the equation counter are actually done with fakeequation,...

4

You can use achieve this by using \newtheoremstyle macro. A working example is given below: \documentclass{article} \usepackage{amsthm} \newtheoremstyle{newtheorem}% name {.5\baselineskip \@plus5\p@}% Space above {.5\baselineskip \@plus5\p@}% Space below {\itshape}% Body font {}% Indent amount 1 {\bfseries}% Theorem head font {\normalfont.}% Punctuation ...

3

I prefer to avoid monkeying with counter names. \documentclass{article} \usepackage[many]{tcolorbox} \usepackage{cleveref} \newcounter{savedequation} \newcounter{tcbequation} \newtcolorbox{note}[1][]{% code={% \setcounter{savedequation}{\value{equation}}% \setcounter{equation}{\value{tcbequation}}% \renewcommand{\theequation}{N\arabic{...

3

With the help of the \beamer@slideinframe counter you can confine you commands to the first slide: \documentclass[14pt]{beamer} \newcounter{lessontime} \newcounter{activitytime} \makeatletter \newcommand{\addtime}[1]{% \ifnum\the\beamer@slideinframe=1% \setcounter{activitytime}{#1}% \addtocounter{lessontime}{\value{activitytime}}% \...

3

Perhaps you should approach this differently. Instead of including the counter setting and addition as part of the frame, set it outside the frame: \documentclass{beamer} \newcounter{lessontime} \newcommand{\activitytime}[1]{\addtocounter{lessontime}{#1}} \begin{document} \activitytime{10} \begin{frame}{Frame 1} \only<1>{One} \only<2>{Two}...

3

Redefine \zz to check for an optional argument. Anything non-blank will inhibit the blue text. \documentclass{article} \usepackage{xcolor} \def\textnumero{No.} \begin{document} \newcounter{zzadacha}[section] \newcommand{\zz}[1][]{\addtocounter{zzadacha}{1}% \if\relax#1\relax\textbf{\hspace{1 pt} \color{blue}\textnumero \hspace{1 pt}\arabic{section}.\...

3

The memoir class provides two macros, namely \lastpage and \lastsheet which will print the page number of the last page and the number of sheets of paper required for printing the document single sided. To date I have not heard of any problems with these. They can be used like this: \documentclass[a4paper,...]{memoir} ... \begin{document} ... The last page ...

2

Naturally there is a counter. \c@page (which is defined as \count0) and you can access its value: \documentclass[a5paper, 11pt]{scrbook} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} \begin{document}\makeatletter Seite \the\value{page}--\the\c@page --\the\count0 \newpage Seite \the\value{page}--\the\c@page --\the\count0 \end{document} But you ...

2

One can argue about this approach: A reset equation in each \section* is without information which section is meant actually, so cross-referencing might become difficult, unless hyperref is used with correct linking. In this solution I applied \xpretocmd for \section to reset the equation counter (which is probably done anyway), so both for \section and \...

2

Is this what you desire? I would apply the \if.... test inside of the TestEnvironment. \documentclass{article} \RequirePackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{lettrine} \usepackage{blindtext} \usepackage{gtrcrd} \newcounter{Cnt} \setcounter{Cnt}{1} \input EileenBl.fd \newif\ifuselettrine \newcommand*\initfamily{\usefont{U}{EileenBl}{xl}{n}}...

2

The page counter is very tricky, also for xassoccnt (yet). What is working for basically any other counter causes troubles with page, i.e. the counter value is off by one usually. Another issue is \NewTotalDocumentCounter starts at -1 -- I will change this in a new version of xassoccnt in order to make it freely adjustable with some option key value. ...

2

We can add a hook at \stepcounter using etoolbox. Without amsmath the patch could be \apptocmd{\stepcounter}{\csname action@#1\endcsname}{}{} but amsmath already does a change. \documentclass{book} \usepackage[pagestyles]{titlesec} \usepackage{emarks} \usepackage{amsmath,amssymb} \usepackage[amsmath,thmmarks,thref,hyperref]{ntheorem} \usepackage{etoolbox}...

2

The code by the O.P. was already working, also with hyperref, but it placed a mark every time a counter was refstepped. I've place some expl3 code to 'register' counter names in a sequence that should be tracked for convenience and perform a check in the redefined \refstepcounter command that only the relevant mark will be placed. \documentclass{book} \...

2


2

This is pretty simple with chngcntr package and \counterwithin This command places the relevant counter from the first argument in the reset list of the counter in the 2nd argument. The counter output will automatically adapted with this command. Be careful with hyperref though: The package must be loaded before \counterwithin to provide correct linking! ...

2

The example for the table continous counting works just by chance since \ifthenelse requires three arguments, not just two of them. \ifthenelse{test condition}{true branch}{false branch} Omitting the false branch for the first two examples must fail since it tries to read the next \ifthenelse etc. For the last one LaTeX assumes that the last argument is ...

2


2

The standard \thmhead command typesets the note/attribution in a group. The easiest way is to remove the group. I added also a differently styled environment to show that the behavior is uniform. \documentclass{article} \usepackage{amsthm} \makeatletter \def\thmhead@plain#1#2#3{% \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}% \thmnote{ \the\thm@...

2

Using etoolbox's arithmetic with macro commands: \documentclass[11pt,paper=a4,answers]{exam} \usepackage{ifthen} \usepackage{etoolbox} \usepackage{environ} \newtoks\allanswers \NewEnviron{answer} {% \edef\temp{% \the\allanswers % the previous ones \thequestion) \thechoice \noexpand\par % maybe \par has been redefined \unexpanded\expandafter{\...

1

Use the dedault and don't confuse yourself with self made trouble. \documentclass[a4paper, numbers=noenddot]{scrbook} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{csquotes} \usepackage{hyperref} \begin{document} \appendix \chapter{Animals} \section{Wombat} \section{Capybara} \section{Mara} \chapter{People} \section{Donald} \...

1

Since frame itself does replicate the content somehow with each slide, a \newcounter command inside a frame with more than slide is of course leading to a multiple definition of slideno, which is wrong. Put the \newcounter{slideno} definition into the preamble (which is always a good idea for counters.) There's also missing % in the \forloop \forloop{...

1

Counters bound to other counters are reset when the master counter is “stepped” with \stepcounter. So I guess that \newcommand{\sect}[1]{% \stepcounter{section}\addtocounter{section}{-1}% \section*{#1}% \addcontentsline{toc}{section}{#1}% } is what you really want. Unless you want that \section{A} \sect{B} \section{C} gives 3 as the section ...

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