Hot answers tagged

19

\documentclass[pagenumber=footright, DIV=20, fontsize=16]{scrartcl} \usepackage[automark]{scrlayer-scrpage} \pagestyle{scrheadings} \ihead{} \ofoot[\pagemark]{\pagemark} \chead{} \cfoot[]{} \ohead{} \begin{document} \def\x{\ifnum\value{page}<501\mbox{}\clearpage\expandafter\x\fi} \x \end{document}


19

Use a primitive \loop with \repeat and \unless testing. \documentclass[pagenumber=footright, DIV=20, fontsize=16]{scrartcl} \usepackage[automark]{scrlayer-scrpage} \pagestyle{scrheadings} \ihead{} \ofoot[\pagemark]{\pagemark} \chead{} \cfoot[]{} \ohead{} \newcounter{loopcntr} \begin{document} \loop\unless\ifnum\value{loopcntr}=500 \mbox{} \newpage \...


13

A variant with package multido (50 bytes): \documentclass[DIV=20, fontsize=16]{scrartcl} \usepackage{lmodern} \usepackage[automark]{scrlayer-scrpage} \pagestyle{scrheadings} \cfoot{} \ofoot[\pagemark]{\pagemark} \usepackage{multido} \begin{document} \multido{}{500}{\null\newpage} \end{document}


12

With expl3: \documentclass[pagenumber=footright, DIV=20, fontsize=16]{scrartcl} \usepackage[automark]{scrlayer-scrpage} \usepackage{expl3} \pagestyle{scrheadings} \ihead{} \ofoot[\pagemark]{\pagemark} \chead{} \cfoot[]{} \ohead{} \begin{document} \ExplSyntaxOn \prg_replicate:nn { 500 } { \mbox{}\newpage } \ExplSyntaxOff \end{document} With no ...


4

The following is how I'd do it. It's very similar to David Carlisle's answer, but in a way which makes the recursion slightly clearer to me (trying to remember how \expandafter works always gives me a headache!). \begin{document} \def\x{\ifnum \count0>500 \let\next\relax \else \null\clearpage \let\next\x \fi \next} \x \end{document} ...


4

You are expanding \\ to its newline meaning before calling lua. Use tex.sprint("\string\\include{ same issue in your added babel example, you are expanding " too early as a babel shorthand. You can disable all Tex expansion of the argument via: \directlua{\detokenize{ for i=1,2,1 do tex.sprint("\\include{text/", i, "} ") end }}


2

I can suggest a key-value interface: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \keys_define:nn { vincent/printnumbers } { start .int_set:N = \l_vincent_printnumbers_start_int, step .int_set:N = \l_vincent_printnumbers_step_int, end .int_set:N = \l_vincent_printnumbers_end_int, wrapper .tl_set:N = \...


1

\foreach executes every cycle in a group; so when you do the first cycle in the first \foreach, what's actually done is \begingroup \csdef{isProblemShow1}{0} \endgroup and the definition is forgotten as soon as \endgroup is executed. In the second loop you do \begingroup Problem 1\quad is \csuse{isProblemShow1} \par \endgroup \begingroup Problem 2\quad ...


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

A recursive stack (\fbox thrown in for flair [easily removed]). Note also the stack spacing has no effect on the underlying line spacing of the document. \documentclass{article} \usepackage{stackengine} \newcounter{loopcounter} \newcommand\makestack[3]{% \def\currentstack{#2}% \setcounter{loopcounter}{\the\numexpr#2-1\relax}% \loop\unless\ifnum\value{...


1

\@... named macros require the \makeatletter...\makeatother pair unless being defined in .sty or .cls files. \documentclass{article} \makeatletter \newcommand{\Der}[1]{% \@for\@token:={#1}\do{\partial_\@token}% } \makeatother \begin{document} $\Der{x^2,y^3,z^{17}}$ \vskip2\baselineskip $\Der{{x_1}^2,y^3}$ \end{document}


1

You can use the in-built functionality of evaluate along with count provided by Tikz. So we start a count from 0 and then we can do evaluate=\xx as \mymod using {mod(\xx,2)}, where the results will be 0,1,0,1,0,1,0,.... After this we can do evaluate=\xx as \varC using int(2*(\mymod+1)) and the results will be int(2*(0+1)) == 2 int(2*(1+1)) == 4 ...



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