# Tag Info

55

Simply end the paragraph before closing the group associated to \Large so the corresponding \baselineskip will be applied; you can do this by adding \par: \documentclass{article} \begin{document} \begin{center} \Large\textbf{The Great Thesis About Some Very Great Things Indeed With a Pretty Long Title That Will Probably Be Split Between at Least Two Lines ...

51

This question is about several things at once, which makes answering it somewhat interesting. others have taken one tack, I'll take a different one. First, bear in mind that TeX is a macro expansion language, not a functional language. Secondly, note that TeX has very few built-in variable types. A lot of 'variables' are therefore macros with appropriate ...

43

LaTeX's optional arguments viz TeX's macro arguments (delimited and undelimited) The LaTeX concept of optional arguments (i.e., arguments that may or may not been used) is a concept that is not directly supported by TeX's parsing and execution. TeX macros always expect the same number of arguments with the same syntax for delimiting the argument. Optional ...

31

Let's look step by step \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname directlua\endcsname\relax A \else B \fi This becomes (\begingroup)\expandafter\endgroup \ifx\directlua\relax A \else B \fi The \begingroup has already been digested, so I leave it in parentheses just to remember a group has been opened. ...

27

I have a little bit different opinion about \bgroup versus \begingroup than the previous answer. First, I give a short explanation about TeX internals: The { and } (more exactly the tokens with catcode 1 and 2) have four different meanings in TeX: they are the syntactic part of macro definitions: \def\foo...{...} each sequence of tokens scanned as single ...

23

The concept of global and local has to do with assigning meaning to a token or a value to a register. Tokens and their meaning Tokens are the basic food of TeX and they come in two varieties: character tokens and symbolic tokens. Roughly speaking, the latter are those that we represent as "backslash+characters". The meaning of a character token depends on ...

22

As Alan Munn said, using braces is one way to go. You an also simply define your own environment: \newenvironment*{dummyenv}{}{} And then use it like you normally would: \begin{dummyenv} \newcommand*{\scopedcommand}{Do stuff} \scopedcommand % This works \end{dummyenv} The two arguments to newenvironment are the code to insert before the content of ...

21


20


19

Group only the brackets or the whole expression with additional curly braces. \documentclass{article} \begin{document} \begin{description} \item[\texttt{DoSomething(items{[]})}:] \item[{\texttt{DoSomethingElse(items[])}:}] \end{description} \end{document}

19

AMS alignments are executed twice internally, a first pass to measure the fields and a second pass to typeset. \label is given a null definition the second time to avoid duplicating writes to the aux file which would generate errors. So you do a global let of the real definition but you don't see it as you globally let to the null definition on the second ...

19

There is a primitive \global that makes a following TeX assignment global. So you can use \global\setbox and \global\def = \gdef. In LaTeX as David Carlisle kindly points out you may get away with \global\setlength in some circumstances, but in general it is not guaranteed to work, and loading packages such as calc in fact prevents it working. One work ...

18

Soln 1 This might be considered overkill, but I once wrote a function \group_after_set:NNn to provide an "abstraction" to handle this, used as in: \group_begin: \group_begin: \group_after_set:NNn \int_set:Nn \y {3} % \y == 3 \group_end: % \y == 3 \group_end: % \y == undefined I quite like it but I don't know if should be added to expl3 or ...

18

If you issue \setfooter{foo} at the top level, that is not inside a group or an environment (and document doesn't count as environment in this respect), there's no difference. However, an input such as {\setfooter{foo}} would result in \mypackage@footer not be defined any more as soon as the closing brace is scanned. If you suspect that users of your ...

18

This is in reply to the OP's question in the @vonbrand answer thread. In fact, an empty group in the middle of a word (but not just a command by itself) prevents kerning (special spacing between pairs of letters) and ligatures. The effect on ligatures is the most visible. \def\f{f} ffi % => ligature of ffi f\f i % => ligature of ffi f\f{}i % =&...

18


18

You could use { \globaldefs=1 \makefoobar } All assignments are global while \globadefs is non zero. Beware though, lots of things will break with the setting, use with care.

17

oh sneaky Heiko:-) It tests whether the csname was undefined (or relax) but in the case that it was previously undefined, it leaves it undefined as the implicit definition to \relax happens inside the group. plain TeX: \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname aaaa\endcsname\relax \show\aaaa \fi \expandafter\ifx\...

17

Whenever TeX starts a new level of grouping it records the current type of group so that it can do the right kind of action if a group ends. If hboxes are build it distinguishes between hboxes in horizontal mode (group code 2) and those in vertical mode (group code 3). What is different betwen the two is that in the vertical case ins_node, mark_node and ...

16

The reason here is that \csname ...\endcsname will define ... as a macro equal to \relax should it not already exists. This feature is used with \ifx which compares it to \relax. This test is true if ... wasn't defined before (or was \let to \relax). However, it isn't good practice to define macros even to \relax just for testing their existence. e-TeX ...

15

Macro definitions are considered as the "replacement text" for the given "macro and argument". So, with a definition like \newcommand*{\setfooter}[1]{\def\mypackage@footer{#1}} the use of \setfooter in your code is replaced with \def\mypackage@footer{#1}. If \setfooter is [not] inside a group, then \def\mypackage@footer{#1} will also [not] be inside that ...

15


15


14

TeX does not kern between two different fonts. The bold and plain variants are from a different font (cmr10, cmb10). LuaTeX kerns across { and }, so {why}, gets its kerning, but not (see point 1) {\bf why},. PDFTeX (and older) behave as Knuth's TeX which does not kern across groups.

14

Having a quick look at the definition of \end{center} we see that it just ends a trivlist, \def\endcenter{\endtrivlist} now as to why Lamport would use a trivlist to define the centering and indirectly the center macros is a subject for another question, it suffices at this point to just say he was very fond of them, although I am sure he had some valid ...

14

Use braces to create a group: \documentclass{article} \usepackage{fontspec} \begin{document} Vivamus gravida lacus a sapien {\fontspec{Arial}interdum} eget interdum mi sodales. Aenean nisi nunc, feugiat a auctor sed, consectetur ut elit. In id tellus ac lectus ullamcorper tempor \end{document}

14

This answer gets the job done, but it might not be as clean and efficient as you would like. It builds on the answer to your previous question and adds layers (background layer). \documentclass[border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{backgrounds} \usetikzlibrary{shapes.geometric} \usetikzlibrary{shadows} \newcommand{\dbpart}[1]{ \node[...

14

The solution is hidden in the package documentation: This command [...] may be prefixed with \global. The meaning of this is that usually \toggletrue will work locally, that is the setting is undone by the enclosing group. \footnote here defines a group. So you need to use \global\toggletrue{SL}% switches to true after first occurrence! in your macro ...

14

There is no official way to do it in LaTeX. Color changes are bound to groups. That the "global trick" works with older versions of pdftex.def is due to the shortcomings of the color implmentation there. Older versions of pdfTeX do not provide a color stack and have therefore serious trouble with page breaks. Dvips provides a color stack where the current ...

14

\par does not end the effect of \centering, the end of the paragraph is just the place, where TeX uses the values set by \centering. A group can be used to limit the effect of \centering. After the group, the settings before the group are in force again. \begingroup \centering ... \par \endgroup or {\centering ...\par}.

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