Tag Info

2

I think, you meant \@arabic instead of \arabic? The former expects a number, the latter a counter name. The calculation can be done in an expandable way via e-TeX's \numexpr: \@arabic{\numexpr(#1)-1\relax} Package intcalc also supports non-e-TeX: \@arabic{\intcalcDec{#1}} Both commands are working very well: \documentclass{article} ...

3

The \titlespacing command uses some tricks for extracting the plus and minus dimensions and doing some computations; the \relax token disturbs the processing, because \relax is used as terminator of an argument in one of the internal macros. \documentclass[11pt,a4paper]{book} \usepackage{lipsum} \usepackage{titlesec} \newlength{\textsize} \makeatletter ...

10

Two alternatives to David's answer: e-TeX provides \glueexpr, which allows to add glue specifications: \newlength{\textsize} \makeatletter \setlength{\textsize}{\f@size pt} \makeatother \setlength{\parskip}{\glueexpr\textsize + 0pt plus 1pt\relax} If \textsize is not intended to have stretch or shrink components, then a dimen instead of a skip register ...

6

\newlength{\textsize} \makeatletter \setlength{\textsize}{\f@size pt} \makeatother \setlength{\parskip}{12pt plus 1pt} % WORKS \setlength{\parskip}{1\textsize plus 1pt} % FAIL \showthe\parskip LaTeX lengths are skip registers so \textsize is a complete glue specification and can not take a further plus component. 1\textwidth coerces this to a dimen, ...

2

Well as the macro name implies it is a pretty-printer not the math parser. You need to do the math outside and supply the result to it. But if you do the regular TikZ parsing the numbers are too big to handle. Hence you need to turn on the fpu of TikZ do the math and turn it off. log number format code/.code={% \pgfkeys{/pgf/fpu}% ...

2

You are missing , in {1,...\n-1} which should be {1,...,\n-1} Note the , after .... Further I have defined \n-1 as a macro and taken it outside the loop (this can be done with the facilities of \foreach too though). \documentclass{standalone} \usepackage{pgfplots,tikz} \usetikzlibrary{calc} \pgfplotsset{compat=newest} \begin{document} ...

1

Yet another solution: Edit: The first version of this code contained a stupid error that prevented it from working when the number generated by the reference contained more than one digit; I have now corrected this. \documentclass{article} \makeatletter \@ifdefinable\striphbox{\def\striphbox#1\hbox#2% #1 is the number, #2 is {} {{#1}} } ...

1

You can use a combination of refcount and expl3: \documentclass{article} \usepackage{lineno,refcount} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff \begin{document} \linenumbers First line Second line\linelabel{ls} As found in \calc{\getrefnumber{ls}-1} \end{document} \getrefnumber expands its argument ...

1

You could do something like this in a simple case. Obviously, I don't know what your more complex usage requires. This just uses LaTeX counters. I've changed the reference to use an enumeration because \ref{ls} did not return a number, so obviously could not be used. \documentclass{article} \begin{document} \begin{enumerate} \item First line ...

1

You can adjust that with \totlaformat command. \totalformat{\fbox{\bfseries Total: \totalpoints\ pts}} Do your customizations here. \documentclass[addpoints]{exam} \totalformat{\fbox{\bfseries Total: \totalpoints\ pts}} \pointpoints{pt}{pts} \bracketedpoints \begin{document} \begin{questions} \question How are you? \droptotalpoints %% put ...

Top 50 recent answers are included