# Tag Info

3

In every case below, remove the extraneous braces: \def\WPpagequestion{\WPhomepagebase 201545} to prevent those braces from being included in the URL. Plain TeX A Plain TeX way for solving this would be: \def\href#1#2{% \begingroup\def\x{\endgroup\goto{#1}[url(}% \expandafter\x#2)]% } or the more drastic: \def\href#1#2{% ...

0

You have forgotten to include \usepackage{booktabs}. Your code could be: \documentclass{article} \usepackage{booktabs} \usepackage{spreadtab} \begin{document} \begin{spreadtab}{{tabular}{lcc}} \toprule @ Product name & @ Price & @ Count \\ \midrule @ product & 60 & 2\\ @ book & 90 & 4 \\ @ pen & 40 &10\\ @ other ...

6

Do you mean some thing like this? \documentclass[tikz]{standalone} \usetikzlibrary{decorations.markings} \tikzset{ arrowmark/.style 2 args={postaction={decorate},decoration={markings,mark=at position #1 with \arrow{#2}}} } \begin{document} \begin{tikzpicture} \draw[arrowmark={.2}{<},arrowmark={.8}{>}] (0,0) -- (5cm,5cm); \end{tikzpicture} ...

9

You can use my macro \seplist exactly for purposes described in your question. The macro \seplist has the following syntax: \def\yourmacro#1{... macro with normal #1 without separator} \seplist{list of separators}\yourmacro parameter text For example: \def\macro#1{parameter is: "#1"} \def\separed{\seplist{{sepA}{SepB}{SEPC}}} \separed\macro text ...

1

I know this question has created an argument, and some users here think it's not straightforward nor useful. However, as I said in the question, it was curiosity, so wipet's solution does work. However, I tend to understand much more easier expl3 code rather than the TeX primitives alone (for instance, many macros used here were found just by logic, ...

7

Fully discussing the topic would be really too long, so I'll describe some general facts to give the flavor. Some TeX primitives require very specific tokens to follow them. To make some examples, I'll mention \over that can be followed by anything legal in math mode and \uppercase that, instead, wants to see after it a <general text>. So in the case ...

17

The \expandafter primitive expands after exactly one token: it does not take two arguments. As such \expandafter\uppercase{\xx} skips over \uppercase and tries to expand {, which is unexpandable and so nothing happens. Thus this is entirely identical to simply writing \uppercase{\xx} Thus in general what you have to do to expand the argument after a ...

2

There is another approach: direct usage of \halign primitive. Note the following feature of \halign: \halign{first:#. && rep:# \cr a& b& c& d& e \cr u& v& w& x& y \cr} creates: first:a. rep:b rep:c rep:d rep:e first:u. rep:v rep:w rep:x rep:y In other words: you needn't to declare all columns ...

5

Replacing c by >$c<$ in a tabular as requested here is basically defining the array environment. Also there is no harm in declaring more columns than used, so the number of columns argument isn't really needed, just declare a large number (50 here) \documentclass{article} \usepackage{array} \usepackage{tabularx} \newenvironment{fancytable} ...

7

The best solution to a simply 'repeat n-times' in a tabular preamble is indeed to use the * syntax as in barto's answer. However, if you do want to use a macro containing the preamble for some reason, using Bruno's solution to How do I expand a macro into a tabular head?, then the important thing to do is to make sure it contains exactly the preamble text. ...

4

Thanks to Daniel for the suggestion, no need of \repeatstring here. \documentclass{article} \usepackage{array} \usepackage{tabularx} \newenvironment{fancytable}[1]% {\begin{tabular}{>{$}c<{$} | * {#1} {>{$}c<{$}} } } {\end{tabular}} \begin{document} \begin{fancytable}{2} x & x^2 & x^3\\ y & y^2 & y^4 ...

9

Instead of \scantokens\expandafter{\code@temp}, you can pass the string to Lua, let it split the string at new lines, and tex.print each line. Calling tex.print only once would result in a single line of input, and no amount of catcode trickery would make TeX behave as if there were multiple lines. I thus use the following Lua code in the full example ...

6

The question gives me a sense if it is read from its end: give the possibility of creating a macro which expands its parameter during parameter scanning. Then the variants } or \egroup as a delimiter of the parameter is serviceable. I've created the \eparam macro with this syntax: \def\mymacro #1{the #1 parameter is declared as undelimited} ... ...

4

Here are two versions that give slightly different behavior, depending on what you really seek. \documentclass{article} \usepackage[T1]{fontenc} \newcommand{\mytest}[1]{\texttt{#1}} \def\mydump#1{\detokenize\expandafter{#1}} \def\mydumplit#1{\detokenize{#1}} \begin{document} \mydump{\mytest{Hello World}} \mydumplit{\mytest{Hello World}} \end{document} ...

Top 50 recent answers are included