Hot answers tagged

5

This is easy enough using expl3 (there are several possible approaches): \documentclass{article} \usepackage{expl3,xparse} \ExplSyntaxOn \DeclareExpandableDocumentCommand \mycmd { m } { \__mycmd_loop:nN {#1} aeiouAEIOU \q_recursion_tail \q_recursion_stop } \cs_new:Npn \__mycmd_loop:nN #1#2 { \quark_if_recursion_tail_stop_do:nn {#2} { a } ...


5

Here's an approach with expl3 \documentclass{article} \usepackage{xparse,glossaries} \ExplSyntaxOn \DeclareExpandableDocumentCommand{\indef}{m} { \str_case_x:nnF { \tl_head:f { \tl_lower_case:n { #1 } } } { {a}{an} {e}{an} {i}{an} {o}{an} {u}{an} } {a}~#1 } \ExplSyntaxOff \begin{document} \indef{abc} --- \indef{cde} --- ...


5

As you have named the coordinates, just loop over their names: \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows,calc} \begin{document} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm] \clip(-0.5,-1) rectangle (5.5,3.5); % defining coordinates \coordinate (1) at (0,0); \coordinate (2) at ...


4

You have to pass \EANBarcode an explicit number: \documentclass[a4paper]{article} \usepackage{labels} \usepackage{GS1} \usepackage{forloop} \LabelCols=4 \LabelRows=11 \GSSetup{module_height=15mm} \begin{document} \newcounter{loop} \forloop{loop}{1}{\value{loop} < 45}{% \addresslabel{% \expandafter\EANBarcode\expandafter{\the\value{loop}}% }% ...


1

Here's a LuaLaTeX-based solution. It defines two fully-expandable "wrapper" macros named \mycmd and \mkfirstuc, which pass their arguments to Lua functions named mycmd and mkfirstuc. The Lua functions perform the actual work of prefixing "an " or "a " to a string and of upper-casing the first character in the string, respectively. % !TEX TS-program = ...


1

Use a different strategy: \newtheorem*{blurb}{Theorem \whatever} \newcommand{\whatever}{} \newenvironment{theorem}[1] {\renewcommand\whatever{#1}\begin{blurb}} {\end{blurb}} so you can do \begin{theorem}{3.25} in your document.


1

Is this what is meant? It is not the most effective usage of expl3, I know ;-) \documentclass{article} \usepackage{xparse} % used in example below \usepackage{pgffor} % used in example below \usepackage{xstring} % used in example below \ExplSyntaxOn \clist_set:Nn \l_tinytot_lowercaseletters_clist {a,e,i,o,u} \clist_set:Nn \l_tinytot_letters_clist ...



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