Hot answers tagged

9

(Admittedly, the example with \color) could be achieved without this, but let us assume \mycmd is more complex for the real case and not a toy 'theory';-)) Collecting the environment body is easiest with environ package and its \NewEnviron command and \BODY. \documentclass{article} \usepackage{xcolor} \usepackage{environ} \usepackage{blindtext} ...


7

You want to expand mychoice before calling \selectpet so: \expandafter\selectpet\expandafter{\mychoice}


6

OpenType support in TeX as of when I first wrote xfrac in early 2004 was basically non-existent - XeTeX hadn't even been released back then. Therefore, the package was never designed with that in mind. Besides, the fundamental purpose was to provide a way to write nice fractions for fonts that didn't include them. The package could very likely be made ...


5

I'm not sure if you really want this; however, here it is. \documentclass{article} \usepackage{amsmath} \usepackage{unicode-math} \ExplSyntaxOn \NewDocumentCommand{\defineoversetchar}{m} { \clist_map_inline:nn { #1 } { \kasper_define_overset_char:n { ##1 } } } \cs_new_protected:Nn \kasper_define_overset_char:n { \cs_new_protected:cn { ...


4

You have to construct the macro name with \csname A#1\endcsname. In fact, a lot of package or class code makes use of this \csname ...\endcsname construction and it's not restricted to LaTeX, since both macros are TeX primitives actually. Please note: \AA is already defined, providing a Scandinavian character, i.e.s something like Å (But since the command ...


4

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


4

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


3

Here I create \altfrac{}{}. It does not require fontspec, it obeys math mode, its font is larger than that of \sfrac, the denominator lies on the baseline, while the top of the numerator I tries to lay at the top of the normal text font. The numbers are presented in \footnotesize. The slash is a horizontally stretched / to give it more of the fractional ...


3

You're missing \makeatletter...\makeatother pairs -- those are necessary due to \@ as macro (starter) name. If the 'string' macro should not be indicated as internal (\@.... are internally 'hidden) choose another name, like \mystringvar, this will remove the issue with \makeatletter...\makeatother \documentclass{article} \begin{document} \makeatletter ...


2

Christian has shown what you could do instead but to explain the error @ is not a letter in the main document so \let\@var\@empty does \let\@=v then typesets ar\@empty producing the paragraph text arvempty (which you don't see as later errors prevent a pdf being made. Then \newcommand{\append}[1]{ \xdef\@var{\@var #1} } defines \append to typeset ...


2

It's a parbox and boxes never break however to avoid spurious white space you are missing one % at the end of the penultimate line. \newcommand{\totalpoints}{% \parbox{\linewidth}{% \leavevmode\raisebox{-0.5ex}{\llap{\textbullet}}\!\hrulefill\\[-0.825ex]% \null\hfill\bfseries Total Points: \total{totalpoints}~~\rlap{\rule{0.4pt}{3ex}}% }% } ...


2

\documentclass[pagesize=pdftex,DIV=16]{scrartcl} \usepackage{xcolor} \usepackage{hyperref} \newsavebox\TBox \begin{document} \begin{Form} \section*{Principal Investigator} \sbox\TBox{Full Name: }% \TextField[backgroundcolor=gray!30,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{Full Name:}\\[1ex] ...


2

I wonder about the \string#1 inside. The new command inside can be constructed with \expandafter\NewDocumentCommand\csname #1\endcsname{...}{....} i.e. the name of the new sequence must be constructed first with \expandafter (first the name is given, then \NewDocumentCommand comes into action). The same approach has to be taken for the traditional ...


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


1

You can use minipage to generate a separation as reqested: \documentclass{article} \usepackage[T1]{fontenc} \begin{document} \begin{minipage}{0.20\textwidth} %left column Tech \end{minipage} % \hfill\vline\hfill % \begin{minipage}{0.70\textwidth} %right column lot more text multi line wonderful \end{minipage} \end{document} Best, Frank


1

This does not answer your question, since you are making your form with the hyperref Form environment, which I don't understand. If this was as simple as filling a line with a grey box it would be pretty easy, after the model of LaTeX's \hrulefill. Perhaps this information might lead to a solution. \hrulefill in LaTeX uses the TeX primitives \leaders and ...



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