Hot answers tagged

13

Inserting a graphic into a TeX document has two parts: Making sure that from the TeX 'point of view' the space is allowed for correctly Telling the driver (via the appropriate \special or related engine-dependent primitive) to actually place the image in the output Some parts of this process are independent of the driver whilst of course the lowest-level ...


9

In classical TeX a number of math mode fonts are used to supply the output glyphs based on the input, and as observed in the question the relevant \mathcode of the input token. In contrast, when using a Unicode math mode font only one font is used to supply all of the glyphs. As such, rather than the limited number of slots available in a TeX font there are ...


8

Concerning the line \hbox to \hsize{abc} you are actually right in your statement I am expecting the abc to be glued with maximum stretched glue Unfortunately, you can't see the glue, because glue is applied between words, not between letters of a word. The space between the letters is given by the font settings, namely kerning which is not allowed ...


6

While it seems that there is no difference in semantics (but I'm still waiting for answers here), there seems to be a small but consistent difference in performance. First, \the consists of 4 characters and \number of 7, so you can type it almost twice as fast! ;-) Seriously, \the\numexpr seems to be 10 - 15% faster than \number\numexpr. As it's not ...


6

What you need to know for doing a "box arithmetic" is TeX changes vertical to horizontal mode at some places and returns back at others places. \vbox or \vtop has its width given as most wider element in it. If this is whole paragraph then the width is \hsize. So it is typical to set a width of \vbox or \vtop by \vtop{\hsize= something ...} When TeX is ...


6

in tex.web you find @<Declare act...@>= function its_all_over:boolean; {do this when \.{\\end} or \.{\\dump} occurs} label exit; begin if privileged then begin if (page_head=page_tail)and(head=tail)and(dead_cycles=0) then begin its_all_over:=true; return; end; back_input; {we will try to end again after ejecting residual material} ...


5

You can use another separator different than @ that doesn't change catcodes, or use \begingroup\lccode`;=`@ \lowercase{\endgroup \def\@explode#1;#2;#3\@nil}{\edef\@pOne{#1}\edef\@pTwo{#2}} instead of \def\@explode#1@#2@#3\@nil{\edef\@pOne{#1}\edef\@pTwo{#2}} but note that you won't be able to use it in a \makeatletter part of the code. And the ...


4

all registers have a fixed number, counts, lengths, (dimen and skips) boxes there are 2^8 in classic TeX but almost all formats use etex where this is raised to 2^15. xetex also allows 2^15 and luatex 2^16. Other fixed allocations are math families (16 in classic tex and etex, 256 in luatex and xetex). The TeXBook or TeX by topic have the details, along ...


4

It's very simple: when TeX skips over tokens in the “false branch” of a conditional, it still keeps track of conditionals. So the \iftrue in the “false branch” needs a matching \fi, which TeX finds in the one you wanted to match the initial \iffalse. So the false branch is not yet finished and TeX basically gobbles everything until finding \else or \fi. The ...


4

Conditionals keep track only of certain tokens (als conditionals) which lets you have many of them inside others (my English is not fluent today). Easy solution: add \fi in any way you can to balance the \if..\fis. \providecommand*\comment[1]{} \let\commentstart=\iffalse \let\commentend=\fi \iffalse \renewcommand\comment[1]{#1} \let\commentstart=\iftrue ...


4

For example, in the first case, naturally I thought TeX would break the World it is part to the second line since the normal width of the glue is much larger than the page width. Since the glue has no stretch or shrink component 300cm is not the "normal width" it is its fixed width. the only break point in #1\hskip 300cm \hbox{#2} is before the skip ...


4

The horizontal skip sticks to the next thing because there is no way for TeX to break the line here. There is no space following the skip because any space here is consumed by the processing. If you take #2 out of the \hbox, you'll see that only the first word disappears and the rest goes to the next line because now you have a space allowing a line break. ...


4

The term “glue” might be misleading. It is not something that's used to glue letters together, which isn't needed, but rather something that spaces things from one another. Glue can be rigid or flexible; flexibility can be in the amount of allowed stretch or shrink (or both, of course). When TeX is ordered to fill with text some amount of horizontal space, ...


4

fwiw, i long ago wrote a web page briefly outlining these things: http://tug.org/levels.html.


4

The key information in the accepted answer is: load Unicode Math font (UnMaFo) as family 2 and the same font as family 3. The TeX engine (XeTeX or LuaTeX) re-calculates appropriate fontdimens for family 2 and family 3 from UnMaFo when these families are set. After understanding this, I am able to do simple plain TeX macros for unicode math. I did this in ...


4

It is a category code problem of @. The definition used category code "letter", whereas the category code of @ is usually "other" in the main document, example: \documentclass{article} % \FunLetter using @ with category code "letter" \makeatletter \def\@explode@letter#1@#2@#3\@nil{\edef\@pOne{#1}\edef\@pTwo{#2}} ...


3

As already explained, the problem is that @ has category code 11 at definition time, but category code 12 at usage time. Here's an implementation with xparse; the \SplitArgument processor pushes -NoValue- when the argument hasn't the indicated number of tokens to split at, so it's necessary to use \IfValueT in order to print the second part when existing. ...


2

I suppose @ is of catcode 11 (letter) due to \makeatletter at the time of defining \@explode, \explode and \fun. Thus within argument-delimiters at definition-time and within the default-value of the optional argument at definition-time, @ was tokenized as acharacter-token of catcode 11 (letter). Therefore those of your macros processing delimited arguments ...


2

Here's David Carlisle's answer in Don knuth words (The TeXbook, page 264) When TeX sees an \end command, it terminates the job only if the main vertical list has been entirely output and if \deadcycles=0. Otherwise it inserts the equivalent of \line{} \vfill \penalty-'10000000000 into the main vertical list, and prepares to read ...


2

You can use standard \parbox and \makebox commands. There is a subtle point that you seem to be overlooking: the baselineskip might be not uniform with a \vtop (or \parbox[t], which is the same) approach. \documentclass[fontsize=13pt,letterpaper]{scrartcl} \usepackage[textwidth=5in,showframe]{geometry} \usepackage{fontspec} ...


2

This is a suggestion on implementing checking both for letter@ and other-@. \documentclass{minimal} \makeatletter %%---------------------------------------------------------------------- %% Check whether argument is empty: %%...................................................................... %% \CheckWhetherNull{<Argument which is to be checked>}% ...


1

The optional argument of \fun is to hold a comma-separated list of elements that are to be "exploded". With your code, there is always trailing empty element. That trailing element is also processed by the \@for-loop. Therefore the output is always 1:a-2:b, 1:c-2:d, 1:e-2:f, 1:g-2:, 1:-2:, ìnstead of: 1:a-2:b, 1:c-2:d, 1:e-2:f, 1:g-2:, Below is a ...



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