# Tag Info

52

Numbers can be used in a printed document in two different meanings: as symbols representing mathematical objects (note that “1” is not “the number one”, but one of its possible representations, hence a symbol) or words. A number used in the second meaning is, for instance, a date or the reference to a page. Mathematical symbols should have the same shape ...

40

put it into braces {...}, then it will be a math atom and not broken at the end of the line. ${v_{initial} = \SI{1000}{m/s}}$ the prevent an overfull box use \sloppy: \documentclass{article} \usepackage{siunitx} \begin{document} {\sloppy A text with an inline equation which is broken in to two parts but is not wanted right here ${v_{initial} = ... 35 In addition to the previous answers, a further reason might be that at some later point you consider changing fonts. It may happen that you end up choosing a font that uses different numerals for mathematical and ordinary text, or that you are even choosing different fonts for mathematical text and for ordinary text. This actually happened to Don Knuth, see ... 22 I think you can justly regard this strange behaviour as kind of a bug in TeX's sub- and superscript positioning algorithm; it doesn't make sense that both the sub- and the superscript are raised. See below for some suggestions on how to fix the problem. At the end I offer a new positioning algorithm, and I compare it with the old algorithm. (Sorry for the ... 19 Please compare: 2,$2$with \textit{2,$2$}. In the second case the second number remains upright. Additionally, e.g. -2 doesn't give a minus sign before 2. Edited according to OP's request: \documentclass{article} \begin{document} Without \$'s: 2, -2; \textit{2, -2} With \$'s:$2$,$-2$; \textit{$2$,$-2$} The first version is rather unacceptable. ... 18 You can use \rotatebox (from the graphicx package) with the origin=c option instead; a little example: \documentclass{article} \usepackage{graphicx} \begin{document} A\rotatebox{90}{B}C A\rotatebox{270}{B}C A\rotatebox[origin=c]{270}{B}C \end{document} 18 Images are added with a zero depth, i.e. they sit on the baseline. It depends very much on the situation (and personal taste) what the "ideal" placement of a particular image is. So no, there is no way to automatically get-it-just-right (TM). Note that \raisebox allows the use of \height, \depth, \width and \totalheight (=height+depth) which represent the ... 15 TeX features a special primitive for this very case. However, you will have to specify code for all four math styles: \mathchoice{display}{text}{script}{scriptscript} See TeX by Topic for more information. 15 You can directly tell where the baseline should meet the picture using the baseline option \documentclass{article} \usepackage{tikz} \begin{document} the distance \tikz[baseline=-0.5ex]{ \draw [|-|] (0,0) -- (5ex,0); } overarching the activities \end{document} 15 I'm sure you are looking for the holtpolt package and its command \polter, like in the following example: \documentclass{standalone} \usepackage{holtpolt} \begin{document} $a_0+\polter{1}{a_1}+\polter{1}{a_2}+\cdots+\polter{1}{a_n}+\cdots$ \end{document} 15 The enumitem package has an inline option which implements inline versions of the standard lists using starred versions of the basic list environments. As with other enumitem lists, labels and (horizontal) spacing can be set with key values as well as custom settings for the elements between the list items (typically punctuation). \documentclass{article} ... 14 The default positions of sub and superscripts are closer to the baseline in textstyle as TeX tries to maximise the chance that the expression does not disturb the paragraph line spacing. Your first example is the standard setting for inline math, however with the larger scripts caused by the subscripting, TeX has to move them further apart. This is ... 14 A couple of versions, you probably need to fiddle with the spacing to get exactly what you need but: \documentclass{article} \def\cFrac#1#2{% \begin{array}{@{}c@{}}\multicolumn{1}{c|}{#1}\\% \hline\multicolumn{1}{|c}{#2}\end{array}} \def\cFracB#1#2{% \vcenter{\hbox{\strut$#1$\,\vrule}\hrule\hbox{\strut\vrule\,$#2$}}} \begin{document}$ A + ...

13

Using ${....}$ does indeed prevent a formula from being broken across lines but at the cost that you freeze up all spacing within the formula at its natural width. If you write $a=b+c$ then LaTeX generates the following list for you: \mathon \OML/cmm/m/it/10 a \glue(\thickmuskip) 2.77771 plus 2.77771 \OT1/cmr/m/n/10 = \penalty 500 \glue(\thickmuskip) ...

13

In justified paragraphs TeX tries to fill the lines. But it is very difficult, if the line contain large chunks of unbreakable stuff. Then the remaining stretchable spaces are stretched and TeX gives a Underfull \hbox warning. TeX can break inline math at binary and relational operators unless they are inside a subformula. Curly braces or \left and \right ...

12

There is a huge difference if you are using right-to-left languages, like Persian. This should show the difference. \documentclass{article} \usepackage{xepersian} \begin{document} -2 $-2$ \end{document} There is another difference for some characters based on your font. Here I am using BZar.ttf font and as you can see the second form is the correct ...

12

\raisebox will do. The height of the contents of \raisebox is available as \height. The tabular environment puts struts with factor \arraystretch in the rows. Since the first line of your tabular only contains normal text, the strut is very likely larger (and probably larger than the extend of the curly brace). Then the argument of \raisbox can be calculated ...

12

\everydisplay can be used to make a different setting for displayed equations: \documentclass{article} \medmuskip=0mu % \everydisplay{\medmuskip=10mu\relax} \begin{document} \centering $a+b=c+d$ $a+b=c+d$ \end{document}

12

I'm not sure if this is a good idea or not (imagine a new reader searching for equation 2.1, for example), but the following seems to do what you want; note that I've used refstepcounter to increment the equation counter. \documentclass{article} \usepackage{amsmath} \begin{document} The equation $a+1=b~\refstepcounter{equation}(\theequation)\label{myeq}$ ...

12

As other answers have mentioned you may use an extra set of {} however this is essentially equivalent to using \mbox{......} and like all such boxing does two things. It prevents line breaking but it also freezes all white space at its natural size and prevents stretching or shrinking, this makes it even harder to fit the unbreakable box into the paragraph. ...

11


11

\documentclass{article} \usepackage{amsmath} \makeatletter \def\mymacro{\ifinalign@ B\else A\fi} \makeatother \begin{document} $\mymacro$ \begin{align} \mymacro \end{align} \end{document}

11

Taking the definitions you make in the other question, here's a way: \mathchoice has four arguments, stating what's to be done in the various situations; \mathop states how the symbol should be considered with respect to spacing and ending with \displaylimits ensures the same behavior as \sum: \documentclass{article} \usepackage{tikz} \newcommand{\osum}{ ...

11

I'd define a new environment and use adjustbox for this. The principle is the same as in Heiko's answer. \documentclass[a4paper]{article} \usepackage{adjustbox,varwidth,xparse} \NewDocumentEnvironment{bracedrows}{m} {\begin{adjustbox}{valign=t}% \kern-\nulldelimiterspace\left. \begin{tabular}{@{}l@{}}} {\end{tabular}\right\rbrace ... 10 The following defines \inlineequation: \inlineequation[<label name>]{<equation>} Optionally <label name> can be given for referencing the equation. \label afterwards keeps the previous referencing behavior like an environment equation would have done. \refstepcounter is called at the beginning of the inline equation, because package ... 10 I was a little bit surprised to discover that this wasn't already catered for by the fancyvrb package. When using that package, the problem would appear to be because the newline character is defined to be an outer macro, which can't then be gobbled into the verbatim command. So here's a little modification that defines a command \VerbLB which converts ... 10 aligned is intended for this. But also align works if you use \parbox: Text\displaystyle\parbox{2cm}{\begin{align} x &= 1 \\ y &= 0 \end{align}}$\quad more text 9 Anything you enclose within an \hbox or the equivalent LaTeX \mbox will not break. However overflowing into the margins is not a good idea. In the minimal below you can see the effect by using the geometry package to show a border around the normal text area. \documentclass{octavo} \usepackage[showframe=true]{geometry} \begin{document} \mbox{This is an ... 9 You have apparently used the fleqn option and so all LaTeX environments shown in your image are flush left.$\$ is not latex syntax and does its own thing, it is not deprecated it just doesn't work, the most obvious and well documented, aspect of that is that it does not obey fleqn option. If the class (or user) doesn't specify fleqn then the LaTeX ...

9

You need to run this twice \documentclass{article} \usepackage{color} \makeatletter \def\savepos#1{\leavevmode\pdfsavepos\write\@auxout{% \gdef\string\save@#1{{\the\pdflastxpos sp }{\the\pdflastypos sp }}}} \def\xx#1{\expandafter\expandafter\expandafter\@firstoftwo\csname save@#1\endcsname} ...

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