# Tag Info

31

\in@{\foo}{\cslist} % <--- What combination of \expandafter is needed here? If \foo is first expanded, then we have the problem, that \expandafter cannot jump over serveral tokens at once, also the number of tokens is not known. Therefore the latest token is expanded first. But at this stage we cannot add the \expandafter, because we have to insert the ...

23

In olden times, TeX came in two incarnations: initex and virtex. The first binary was used to create formats such as Plain and LaTeX, the second one was used for typesetting documents after loading one of the available formats. So one had to do initex lplain and save the created file lplain.fmt in some suitable directory; from then on, it was possible to ...

21


21

\in@{\foo}{\cslist} If you don't need pure expansion and can afford an assignment, that can simplify things \def\tmp{\expandafter\in@\expandafter{\foo}} \expandafter\tmp\expandafter{\cslist} only needs four \expandafter

11

\def\@name{atname} has not defined \@name, but \@ with parameter text name. Also in plain TeX, the default catcode for @ is 12. \catcode`\@=11 \def\@name{atname} \def\xxx{name} \def\at{@} ==\csname\at\xxx\endcsname== \bye

9

A control sequence definition is composed of three parts: the control sequence name; the parameter text; the replacement text. The parameter text is whatever is placed between the control sequence name and the open brace {1 that delimits the replacement text. It can contain parameter tokens #1…#9, but also other tokens. A control sequence can be formed ...

9

For the sake of the exercise, here is a method without assignments. Don't expect miracles though, it should be fine when testing strings of letters and digits, however spaces will give false positives. This is a first sketch, I use xinttools as I am familiar with it. Some explanations added. \documentclass{article} \usepackage{xinttools} \makeatletter % ...

6

Here's a LaTeX3 implementation. \documentclass{article} \usepackage[margin=1cm]{geometry} % to fit in one page \usepackage{blindtext} \usepackage{xparse} \newcommand{\modulespec}[2]{\section{#1} #2} \ExplSyntaxOn \NewDocumentCommand{\definemodules}{m} { \farley_definemodules:n { #1 } } \tl_new:N \l_farley_temp_tl \cs_new_protected:Npn ...

6

The TeXbook is only about TeX and Plain TeX, the program created by Knuth himself and its first format (also created by him). It says nothing, for example, about the LaTeX or ConTeXt formats, nor about more modern engines like pdfTeX, XeTeX, LuaTeX… (Nota Bene: To be allowed to exist, all those evolutions had to be named differently than TeX and/or Plain ...

6

I took this question as a learning opportunity for me, more than an actual attempt to satisfy a question for you, and so my answer is not yet a generalized approach (though I think it could get there with a little work). I would say this method falls in your category #2, "Using a macro with an argument template (like what we do to see if a token is in a ...

5

One solution is to use TeXcount which is made for counting the words in TeX/LaTeX documents. This is a Perl script that you can download and run, or you could use the online web service. If you run this with the option -freq it will not only give a summary of the total word count, as is the main purpose, but a count of all the different words: a slight ...

5

It looks like you want to do a 'for each' loop. The LaTeX kernel has a macro \@for which does this for each element of a comma-separated list. You also need \zap@space or similar to remove spaces. For example: \newcommand{\modulespec}[2]{\section{#1} #2} \makeatletter \@for\@tempa:=description,learning outcomes\do{% \edef\@tempa ...

3

Using \xintFor and the LaTeX2e kernel utilities (with an @ in their names): \documentclass{article} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{xinttools} % In the real thing, this definition is much more complicated \newcommand{\modulespec}[2]{\section{#1} #2} % % The code I want in pure TeX/LaTeX % for i in 'description' 'learning ...

3

(La)TeX does many things extremely well. It is excellent in typesetting beautiful text, but I think it lacks in areas of larger-scale design. For instance, I have long desired to put all of my recipes into a cookbook format, yet have been hung up on finding a way to do this that looks "good" not only for a small recipe (3 ingredients and steps), but also ...

2

This is a Plain TeX (or any other format) general purpose macro \scanthechars which accepts on input a string of character tokens of catcode 12 (1) and puts them in the same order but with transformed catcodes in a token list register called \replacetoks. (1) this update adds two \string's to the \@@scanthechars macro, and as a result the input is not ...

1

With markup converters like Pandoc it is now possible to generate LaTeX documents without ever touching any LaTeX code. However, obtaining aesthetic page breaks for slightly complex documents, taking for example into account figures, widows and orphans may still require manual intervention in the LaTeX code. Quoting Frank Mittelbach: This issue ...

1

This revised solution addresses the requirement to be able to scale the result to different math style sizes. To do that, features of the scalerel package are employed to import the current math style into the revised definition of \tilde. And, as with the original solution, it provides the desired syntax and does it without frontloading the \tilde with a ...

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