Tag Info

New answers tagged

5

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


6

With e-TeX's glueexpr and converting the factor from a real number to an integer ratio: \bar=\glueexpr\foo*5/2\relax This is a "scaling operation, a multiplication followed by a division. In this case e-TeX uses 64-bit for the intermediate value and the result has to fit in the allowed range, of course.


10

You can use \separateskip macro which separates the three parts of the skip register to the three dimens. The macro scans the \the output of the register. The usage is: \separateskip\foo to \dimA \dimB \dimC Now, the base part is stored in \dimA, the stretch part in \dimB and the shrink part in \dimC. You can do, for example: \bar=2.5\dimA plus 4.7\dimB ...


11

Multiplying by a decimal factor is allowed only for a <dimen>; when a <glue> is used, it is coerced to a <dimen>. The syntax for a <dimen> includes <factor><unit of measure> and <unit of measure> can be <internal dimen> (any dimension register) or <internal glue> (any glue register); see the TeXbook, ...


14

Multiplication and division by integers is possible. So you can do this: \newskip\foo \newskip\bar \foo=10pt plus 2pt minus 3pt \bar=\foo\relax \multiply\bar by 10 \divide\bar by 4 \showthe\bar \bye


3

Specializing my answer from What are the ways to position things absolutely on the page?, this MWE sets up the line on page two, because that is where the \atxy was invoked. The line is 6 inches from the left paper edge, as given in the \atxy arguments. \documentclass{article} \usepackage{everypage} \usepackage{xcolor} \usepackage{lipsum} % THESE ARE LaTeX ...


3

Here is a variation/edit on Ulrike's solution (so please give her the tick!) to get the line to go down the centre of the page. \documentclass{article} \usepackage{tikz} \begin{document} \tikz[overlay,remember picture]\draw[red,dashed](current page.north)--(current page.south); blablablabla \end{document}


4

\documentclass{article} \usepackage{tikz} \begin{document} \tikz[overlay,remember picture]\draw[<->,red,dashed] ([xshift=3cm]current page.north west)-- ([xshift=3cm]current page.south west); blablablabla \end{document}


3

Like this? \documentclass{article} \usepackage{eso-pic,graphicx} \begin{document} \newcommand\AtPageUpperMyleft[1]{\AtPageUpperLeft{% \put(\LenToUnit{4cm},\LenToUnit{0cm}){#1}% }}% \AddToShipoutPictureBG*{% \AtPageUpperMyleft{\color{red}\rule[-\paperheight]{4pt}{\paperheight}} } Some text \end{document} Adjust the value 4cm in \LenToUnit{4cm} as you ...


8

The syntax rules of TeX allow for certain primitives to have an “argument” delimited by \bgroup or \egroup. The main examples are \hbox, \vbox, \vtop, \vcenter, \halign and \noalign. This is the basis where, for instance, \halign LaTeX builds tabular on: with \begin{tabular}{<arg>} the argument is transformed into a suitable preamble for \halign ...


12

I don't know the origin of this question (two macros are the same from \ifx point of view and behaves differently with respect of their name). But I would to present the way to modification of TeX source to solve this task. I don't expect that somebody use this patch. This is only an illustration how easy or hard such modification is. Let me start by ...


4

You can use \ensurebalanced macro for another types of parens by the following way: \def\macro(#1){\ensurebalanced()\macroA{#1}} \def\macroA#1{the "#1" is balanced here in () meaning} \macro(abc(de(f))g(hi)) % prints: the "abc(de(f))g(hi)" is balanced here in () meaning. Or your example: \def\args(#1){\ensurebalanced(){\fence()}{#1}} My macro ...


8

You have \args(bar\args(baz)) so the argument to the outer \args is bar\args(baz as it stops at the first ) you want \args({bar\args(baz)}) in the \foo example, the arguments are interpreted the same way, but it accidentally works. for the outer \foo '#1 is bar\foo(baz so that expands to (bar\foo(baz) then the inner \foo expands to ...


7

There are many examples of plain TeX source files. For example all my books and articles are written in plain TeX: TeXbook naruby / TeXbook inside out Lineární algebra ... There is an example of Bachelor thesis written in plain TeX (including sources): Kvadratické rovnice na slovech It is not true that plain TeX doesn't give possibility to ...



Top 50 recent answers are included