New answers tagged

4

Since we have, in plain.tex 508 \def\lq{`} \def\rq{'} (line number added for reference), you can just type \csname\rq\endcsname that will expand \rq to ' and build a control sequence token out of this. You can't use \expandafter that way: \expandafter\\lq is four tokens \expandafter•\\•l•q (the bullet just separates tokens), so you are trying ...


3

You can use expl3; the \strcompare macro is just a user level version of the expandable internal function \str_if_eq:nnTF. \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \strcompare \str_if_eq:nnTF \ExplSyntaxOff \begin{document} start\par \strcompare{abc}{def}{OOPS}{OK}\par \strcompare{abc}{abcd}{OOPS}{OK}\par ...


1

I've read that with \usepackage{pdftexcmds}, you can use \pdf@strcmp but haven't checked if it works in this case. Alternatively, the code below defines \expandable@if@equal{str1}{str2}{if-case}{else-case}, which can be used as follows: \makeatletter start% \expandable@if@equal{abc}{def}{OOPS}{OK}% \expandable@if@equal{abc}{abcd}{OOPS}{OK}% ...


7

Two excellent answers have already been given, that explain in detail what happens and why: I would just like to add a few remarks, and corroborate the analysis with evidence coming from appropriate tracing commands. I will use the following diagnostic program: % !TEX TS-program = pdftex \showboxbreadth = 1000 \showboxdepth = 10 \output={% ...


8

The main vertical list is split into two parts: the current page and the recent contributions. At certain times, TeX exercises the page builder, that is, moves the items in the recent contributions to the current page: when a penalty is added to the main vertical list (which could be from \vadjust); after the closing brace of an \insert; a box is added to ...


12

I did more exploration about this problem and I hope that I have an answer. First, a short summary from TeXbook terminology. The main vertical list is split to two parts by imaginary horizontal line: current page above this line and recent contributions below it. The current page has the c value (cost) calculated at all possible break points but recent ...


27

Not any character or action is available from a keyboard input as such an escaping to the 'TeX' system is necessary to typeset certain symbols or trigger actions -- in order to distinguish the text "foo" from a an action (call it macro etc.) named "foo" as well a certain method is necessary. D.E. Knuth designed \ to be \ the “escape char” and is used to ...


11

Let's look at how \enddocument is defined (see latex.ltx, the LaTeX "kernel"): \def\enddocument{% \let\AtEndDocument\@firstofone \@enddocumenthook \@checkend{document}% \clearpage \begingroup \if@filesw \immediate\closeout\@mainaux \let\@setckpt\@gobbletwo \let\@newl@bel\@testdef \@tempswafalse ...


13

There are syntactical reasons. LaTeX has the concept of environments, not present in plain TeX. The environment document is the outer environment of the document contents. The setup/configuration of the document is separated from the actual document contents and this is done in the preamble before the environment document starts. The preamble loads the ...


0

If you want to enter roman numbers within your text, please follow these instructions. in the first step you have to install the package of "romannum". in this step you have to use this package in your text,therefore type this: \usepackage{romannum} Now you can write roman numbers in your text in lowercase or uppercase by this command. \romannum{1} for ...



Top 50 recent answers are included