New answers tagged

0

Have you tried to remove \resetcounteronoverlays{cnt#1}, which is the source of the error "Missing number, treated as zero", and simply replace \stepcounter{cnt#1} by \only<1>{\stepcounter{cnt#1}}? In my case, this dirty alternative code (using this trick) works \makeatletter% \newcommand*\ifcounter[1]{% \ifcsname c@#1\endcsname% \...


0

A minimal working example was requested, but I decided the time required to prepare one might be better spend on trying to solve the problem. I defined an exercises environment intended to behave like enumerate and also to keep track of the total number of exercises in the book. I also used package totcounter. Here's what I learned: You can't just ask \...


0

The package moreenum is actually intended to provide a few more styles for enumeration, but it defines a greek numeral system en passant. I guess it is probably the easiest way to make use of this package and define your counter: \documentclass[11pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{...


0

You can define your own environment and counters. \documentclass{article} \usepackage{etoolbox} \usepackage{expl3} \usepackage{xparse} \usepackage{enumitem} \begin{document} \ExplSyntaxOn % define and initialize exercise counter \int_new:N \g_exercise_count_int \int_gset:Nn \g_exercise_count_int {0} \NewDocumentEnvironment{exercise}{O{}}{ % ...


2

The dirty trick follows. The TeX primitive \mathchoice is redefined: \let\orimathchoice=\mathchoice \def\mathchoice#1#2#3#4{\orimathchoice{#1}{\noadvance#2}{\noadvance#3}{\noadvance#4}} \def\noadvance{\def\stepcounter##1{}} % your code: \documentclass{article} \usepackage{mathtools} \newcounter{mycounter} \newcommand{\printMyNextCounter}{\stepcounter{...


3

You can inject in \mathclap the same trickery that amsmath uses for avoiding the issue within \text and related commands such as \textrm and similar. \documentclass{article} \usepackage{mathtools} \MHInternalSyntaxOn %%% original definitions %\def\MT_mathllap:Nn #1#2{{}\llap{$\m@th#1{#2}$}} %\def\MT_mathrlap:Nn #1#2{{}\rlap{$\m@th#1{#2}$}} %\def\MT_mathclap:...


4

You can arrange the counter is reset in each of the four evaluations \documentclass{article} \usepackage{mathtools} \newcounter{mycounter} \newcounter{mycounterx} \newcommand{\printMyNextCounter}{\stepcounter{mycounter}\arabic{mycounter}} \newcommand\mymathclap[1]{% \setcounter{mycounterx}{\value{mycounter}}% \mathclap{\setcounter{mycounter}{\value{...


0

A more simplified approach that I am now using might be a bit easier to read, but of course not as flexible as before, but it makes use of the fact that for PGF you don't need to convert the macros to counters before, hence this works to produce a progress bar that is variable in height and is inverted. It also takes into account muzimuzhi's comment ...


6

TeX has a \maxdimen (16383.99999pt), which represents the largest dimension you can use in an dimension expression. See discussions among \maxdimen on this site, including my answer. When \x == 45, \progressbar@tmpdim == 364.19536pt and \progressbar@tmpcounta == 45, their multiplication 364.19536pt * 45 = 16,388.7912pt, is slightly larger than \maxdimen, ...


2

You can't use \or in that context, I'm afraid. But the code can be made much simpler. I'd prefer comma separated items, rather than separated by \or, so the \FromSet macro is fully expandable. With \clist_count:n we can access expandably the number of items, so we can scale the variable by it; then truncate and add 1. \documentclass{article} \usepackage{xfp} ...


Top 50 recent answers are included