Hot answers tagged

6

Since the question appears to be about the resources taken up by register allocations it should be noted that despite the names \newbox, \newcount etc do not generate new box or count registers. There are 256 or 32768 or 65536 registers of each type available (depending on the engine). These are available all the time whether or not you allocate anything. \...


5

I'm not sure about the counter you want, but tcolorbox creates a \tcbcounter for each box and you can use for later reference. \documentclass{article} \usepackage[theorems]{tcolorbox} \usepackage{amsmath} \newtcbtheorem[number within=section]% {theorem} % \begin.. {Theorem} % Title {} % Style - default {theo} % label prefix; cite as ``theo:yourlabel'' \...


4

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


3

Here is an example of how to locate any unused \newbox. The MWE below defines three boxes: \newbox{\MyBoxA} \newbox{\MyBoxB} \newbox{\MyBoxC} but only box \MyBoxB is ever used, so the other two get reported as unused: Notes: \usepackage{debugboxes} needs to be before any \newbox. If you comment out the \usepackage{debugboxes}, then things work as ...


3

Try this: \usepackage{etoolbox} and \ifnumequal{\value{footnote}}{1}{commands if true}{commands if false}


2

If a counter,say foo, is defined with \newcounter, there's an automatic definition of \thefoo which defaults to \arabic{foo}, i.e. printing the counter values with arabic numbers. \newcounter{foo}[chapter] resets the counter each time a new chapter is started (better: when chapter counter is increased by \refstepcounter or \stepcounter. To change the ...


2

This is quite an easy task with xcntperchap package (I am the author of this package, ok -- shameless promotion ;-)) The main purpose of this package is to count how many Y (here enumi) per track level counter X (here section) occur. The basic usage is \RegisterCounters{section}{enumi,...}, the 1st argument is designed to hold the track level, i.e. the '...


2

The package xcntperchap can do this, with some 'easy' setup, using a dummy track level counter (dummycntr). Since itemize does not use a counter itself, another counter is necessary (for enumerate, it would be much easier, just say \RegisterCounters{dummycntr}{enumi} then. The current version works for the first level of itemize nesting only so far. \...


2

You can change the goal height of the tabular before the problematic line. This will force an earlier page break: \documentclass[a4paper,12pt]{book} \usepackage{helvet} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[francais]{babel} \usepackage{supertabular} \usepackage{lipsum} \begin{document} \newcounter{MyCounter} \lipsum[1] ...


2

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


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


1

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


1

Either use \makeatletter \@addtoreset{footnote}{section} \makeatother or \counterwithin*{footnote}{section} The * prevents \counterwithin from prepending the section number to the footnote number. The first version does not need a package, the second one requires the chngcntr package. \documentclass[12pt, a4paper, twoside]{article} \usepackage[...


1

\csdef etc. does infact allow numbers in 'command' names, but here's another way using \@nameuse and \@namedef from LaTeX2e core with expansion of the counter values -- I don't think that etoolbox is needed here for such an approach! \documentclass{article} \newcounter{cntLocalProblem} \newcounter{cntProblem} \newcommand{\fileprefix}{foo} \makeatletter ...


1

This approach prevents the \refstepcounter code if it's not executed in the \tableofcontents, by using a conditional named \ifnotintoc, being set to false at the beginning of the \tableofcontents. This prevents the generation of the same label again (unless \newtest is used again after resetting of the test counter!) In the ToC stage, the already written ...


1

This can be achieved by resetting counter next to Table of Contents: \tableofcontents \setcounter{test}{0}



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