Tag Info

Hot answers tagged

36

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


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


17

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

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

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}


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


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


13

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}


12

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


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

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


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


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

Here is one way to do it. I took the liberty to add some formatting, but feel free to change it as you wish: \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \newcommand*{\WineMenuColor}{black}% \newcommand*{\StartMenu}{\includegraphics[scale=0.2]{StartIcon}}% \newcommand*{\WinMenu}[1]{% \StartMenu % \foreach \x in {#1} {% ...


11

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


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


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

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

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


9

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


8

Tell TeX that the figure should be as high as a “B”: Some text... \includegraphics[height=\fontcharht\font`\B]{picture.png} ... some more text. You probably want to define a special command for this: \newcommand{\mychar}{% \begingroup\normalfont \includegraphics[height=\fontcharht\font`\B]{picture.png}% \endgroup } and type your paragraph as ...


8

Token register method The problem is that the list environment is not too happy, if \item is put inside a group. \foreach of pgffor puts the body inside groups. The following file uses a token register to collect the body of the environment. \Choice needs to be expanded once. \documentclass{article} \usepackage[inline]{enumitem} \usepackage{pgffor} ...


8

There are some strategies that you could use: enclosing the expression inside braces, or boxing it, but in some cases this can produce overfull boxes. Most of the times the best solution is to rephrase the text where the formula appears so that a line break doesn't occur. An example where things go right: \documentclass[draft]{article} \begin{document} ...


7

You could use TikZ for this. Somewhere at the start of the document, issue \tikzset{ every picture/.style={ remember picture, % Make nodes available to all TikZ pictures inner xsep=0pt, % Remove horizontal padding inner ysep=1pt, % Set small vertical padding baseline, % Align TikZ pictures at the baseline ...


7

There is some glue in \:, but not in \!: the first uses \medmuskip which is 4.0mu plus 2.0mu minus 4.0mu, the second \thinmuskip which is 3.0mu. To avoid the glue use only \! or, simpler, just \mkern: \documentclass[a5paper]{article} \newcommand{\md}{\ensuremath{M\mkern-9mu D}} \begin{document} a a a a a a a a a a a a a a a a a a a a a a $\md$ a a a a ...


7

\documentclass[a4paper]{article} \usepackage{multirow,bigdelim} \begin{document} \begin{enumerate} \item \begin{tabular}[t]{ll} First line & \rdelim{\}}{3}{2.5cm}[Text]\\ Second line\\ Third line \end{tabular} \item foo \end{enumerate} \end{document}



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