# Tag Info

18

\documentclass{article} \protected\def\defun{\expandafter\zdefun\expandafter{\iffalse}\fi} \def\zdefun#1{A \fbox{#1} B\egroup} \begin{document} \section{\defun SomeFunctionName arg1 arg2} Call {\defun SomeFunctionName} to foo the bar. \end{document} Here \iffalse}\fi expands to nothing so \expandafter{\iffalse}\fi expands to a single ...

18

It says “control sequence” because that's the name Knuth chose. In his manual about LaTeX, Lamport decided instead to use “command”. Since those low level error messages are hardwired in TeX, you cannot dispense with or modify them. A control sequence can be \<letters>, for instance \a, \ab, \abc and so on \<nonletter>, for instance \? or \. ...

17

The four expression primitives (\numexpr, \dimexpr, \glueexpr, \muexpr) can be used anywhere that a register of the same type can be. This means that \numexpr produces integers, \dimexpr produces dimensions, \glueexpr produces glue expressions and \muexpr produces muskip values. As such, something like the example in the question \the\dimexpr 12pt / ...

13

Control sequence is (typically, roughly speaking) a sequence of letters with preceded backslash. This is TeX terminology. Control sequence has assigned its meaning. The meaning typically is: TeX primitive ... a command processed by TeX itself (for example \def, \font). macro ... a sequence declared by \def (or similar \edef etc.). For example \newcommand ...

10

Graphics package has code to divide dimens: \documentclass{article} \usepackage{graphics} \makeatletter \begin{document} \def\setdimenzerotofontheightanddepth#1#2{ \dimen8=\fontcharht\font#1 \advance\dimen8 by \fontchardp\font#1 \ifx#2 \else \advance\dimen8 by \fontcharht\font#2 \advance\dimen8 by \fontchardp\font#2 \fi } ...

10

My preferred approach would be: use the find-and-replace function of your editor of choice and replace {\defun with \textdefun{. EDIT: As @Clément points out, this does not work in cases like \section{\defun abc def}. I am afraid those cases would elude even a more sophisticated regexp-based approach, because one would have to add an additional closing ...

9

I can show you the plain TeX solution. You can re-write this to your used macro package as a homework. \input opmac \localcolor \newbox\semphAbox \newbox\semphBbox \setbox\semphAbox=\hbox{{\Black\bf1}} \setbox\semphBbox=\hbox{{\Black\bf2}}% \def\semph#1{\def\tmpb{#1}\replacestrings{ }{\specialspace}% {\Red\copy\semphAbox\tmpb\copy\semphBbox}% } ...

8

You can do it with \aftergroup: \documentclass{article} \protected\def\defun{\aftergroup\newdefun\aftergroup{}} \newcommand\newdefun[1]{\fbox{#1}} \begin{document} \tableofcontents \section{Here {\defun SomeFunctionName arg1 arg2}} Call {\defun SomeFunctionName} to foo the bar. \end{document} The same limitation as David Carlisle's answer holds: ...

8

The syntax rules of TeX tell you that you can \divide\dimen0 by <number> where <number> is an integer. In your case, the expansion of \dimzeroamt is 13.19443, so TeX duly divides \dimen0 by 13 and prints .19443. You can do it with expl3 (also in Plain TeX): \input expl3-generic \ExplSyntaxOn \cs_new_protected:Nn \ioiooiioio_getfactor:Nnnn ...

8

Here's a completely plain tex solution. It´s adapted from the graphics package. \catcode@=11 \begingroup \catcodeP=12 \catcodeT=12 \lowercase{ \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}} \expandafter\endgroup\x \def\strip@pt{\expandafter\rem@pt\the} \def\setdimenzerotofontheightanddepth#1#2{ \dimen8=\fontcharht\font#1 ...

7

Here's a suggestion using a decoration to mark points along the curves and then loop through joining them up. I'm using TikZ-level commands for the decoration which jars slightly with the low-level PGF commands that you're using; but I don't know the low-level equivalents off the top of my head. It works because decorations step along paths according to ...

6

The explanation about \input is in the TeXbook, page 278: The syntax for 〈file name〉 is not standard in TeX, because different operating systems have different conventions. You should ask your local system wizards for details on just how they have decided to implement file names. However, the following principles should hold universally: A 〈file ...

6

The definition of \p@if@ does not work as expected, because of the nesting \if constructs. Much more of \expandafter are needed to clean up the closing \else and \fi tokens. The following example uses a \csname construct to ease the clean up and changes the syntax. \iftrue precedes \p@if@. The latter is a macro and it is not recognized by TeX as part of the ...

5

There is Knuth’s Computers and Typesetting, Volume B, TeX: The Program which is a “documented listing of the source code of the TeX interpreter.” (that is, the WEB (or Pascal) program) But firstly you already have the right book at your hands: The TeXbook. As Joseph said, it indeed answeres your question about \input.

5

The classical TeX has limited arithmetic, so the division of decimal numbers is processed by division by integers and the optimum of precision is found via loop with multiple two (see the answer by 1010011010). But, if you are using eTeX (this is common extension of TeX today) then you can utilize the fact that the integer arithmetic is 64bit when \numexpr ...

4

FWIW, in ConTeXt you can use \startpostponing to print content on a particular page. For example, to position text (or float) on the next page, use: \starttext .... \startpostponing[+1] ... \stoppostponing ... \stoptext To position text or float on a particular page (say 20), use \startpostponing[20] ... \stoppostponing \starttext .... % Content must ...

4

That is the code for \autoref if you want to see the code for the internal command \autoref_ (with a space) then {\let\protect\show\autoref} works > \autoref =macro: ->\leavevmode \@ifstar {\HyRef@autoref \@gobbletwo }{\HyRef@autoref \hyper@@lin k }. \autoref ->\protect \autoref l.4 {\let\protect\show\autoref }

3

Set up a translation table from number to textual representation: \catcode`@=11 \def\p@translate#1{% \ifcase#1\or one\or two\or three\fi } \def\p@settrue@#1{% \csname p@\p@translate{#1}@true\endcsname } \def\p@setfalse@#1{% \csname p@\p@translate{#1}@false\endcsname } \def\p@cond@#1{% TT\fi \csname ifp@\p@translate{#1}@\endcsname } ...

3

You can do that with the tasks package, which emulates a multicolumn enumerate environment. Demo with first your original tabbing environment, then two tasks environments. A few words of explanation: label-offset is the distance between label and item; item-indent is like leftmargin in a list and we have the relation: item-indent=label-width+item-indent. ...

3

To add to the existing answers, "control sequence" has a specific meaning and evokes accurate imagery of a sequence of characters that have control semantics (rather than being printables). The notion of "control characters" is nothing new (even at the time LaTeX came into being) so talking about "control sequences" makes complete sense. On the other hand, ...

2

Here is one example using the \AddThispageHook feature of the everypage package, which as you will see upon compilation, converts to red font between pages 1 and 2, which is after the actual invocation point. \documentclass{article} \usepackage{everypage,lipsum,xcolor} \begin{document} \lipsum[1] \AddThispageHook{\color{red}} \lipsum[2-8] \end{document} ...

2

Just a quick example with docmute. Please note that I only put some packages in the preambles to emphasize that they must be identical or debugging will be difficult, if even possible. IMPORTANT: To prevent really difficult debugging, make very sure that the individual *.tex file with preambles actually do compile individually before running the main ...

1

This is described in the tex faq: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ltxcmds An expl3-variant to show the internal command (which ends with a space as David mentioned): \documentclass{article} \usepackage{hyperref,expl3} \begin{document} \ExplSyntaxOn\cs_show:c{autoref~}\ExplSyntaxOff \end{document}

1

There is a cheap answer in the standard LaTeX document classes: When there are no other floats (figures or tables) around, you can use a float to achieve what you want: 1) At begin of the next page: \begin{figure}[t] \C \end{figure} 2) At end of the current page (i.e. before pagebreak) \begin{figure}[b] \C \end{figure} When you have to deal with ...

1

You can use \begin{tabular}[t] so that the reference point for the tabular is on the first row, then the standard \baselineskip calculation produces the expected space. With the default vertical centre alignment, the reference point is in the middle of the tabular so if the tabular has more than one row it will have height larger than \baselineskip so tex ...

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