New answers tagged

0

A solution with blkarray and eqparbox: \documentclass{article} \usepackage{mathtools, blkarray} \usepackage{eqparbox} \begin{document} \begin{equation} \begin{blockarray}{lc@{{}={}}c} \begin{block}{\BAmultirow{\eqboxwidth{T}}\{c@{{}={}}c} \eqparbox{T}{Text text 1:} & a &b+c\\ & d &e+f \\ \end{block} \...


1

Here I use a tabstackengine approach, on the theory that it allows me to control vertical distances between items precisely. However, the 1.53 in the stackgap setting should, in theory, have been 1.5 exactly. I think the issue is related to how big the \left\{ is made, which in the default LaTeX font, is not purely scalable (see ADDENDUM). The \stackskip ...


1

In addition to using a directive such as \makebox[0pt][c]{...} to contain the first argument of \overset (or, use \mathclap), you should (a) get rid of all \left and \right parenthesis-sizing directives -- use \biggl( and \biggr) for the four large parentheses in the third row -- and (b) align all equations on their respective = symbols. \documentclass{...


2

I apply a \mathclap to the text (mathtools required). \documentclass{article} \usepackage{amsmath,mathtools} \begin{document} \begin{align*} s_yp&=s_zp && \Longleftrightarrow\\ S_yp &= S_zp && \Longleftrightarrow\\ S_y\left(\sum_{x}a_x\delta_x\right) &=S_z\left(\sum_{x}a_x\...


6

I suggest you use \[ \] instead $$ $$ for display math formulas. Like @WillieWong say, with amsmath package You can get a result, perhaps, more appropriate: \documentclass{article} \usepackage{amsmath} \begin{document} \[ \binom{m+n}{m} = \frac{(m+n)!}{m!\,n!} = \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{m \text{ factors}}}{\underbrace{m(m-1)\...


2

This will do: \documentclass{article} \usepackage{amsmath} \begin{document} $$ \left( \begin{array}{c} m+n\\ m \end{array} \right) = \frac{(m+n)!}{m!n!} = \frac{\overbrace{(m+n)(m+n-1)\cdots(n+1)}^{\mbox{$m$ factors}}}{\underbrace{m(m-1)\cdots 1}_{\mbox{$m$ factors}}} $$ \end{document} The ^\mbox{$m$ factors} was changed to ^{\mbox{$m$ factors}} in two ...


0

Based on @egreg's answer, this is what I came up with. It basically defines \gatherleft and \gatherright commands that are consistent in spacing with \multline, even with varying lengths of equation numbers (including tags). It also works with different font sizes, so the 20pt seem to be pretty constant. If anyone knows what those correspond to, I would be ...


3

Observe that the issue you describe does not arise in a LaTeX document if the amsmath package is not loaded: \documentclass{article} \begin{document} $\frac12=0.50000\dots=0.499999\dots$ \end{document} Compare this output with what results if the amsmath package is, in fact, loaded: \documentclass{article} \usepackage{amsmath} \begin{document} $\...


5

Simpler and safer than @Manuel’s (very clever, anyway) solution: \documentclass{scrartcl} % \usepackage{etoolbox} isn't actually necessary \usepackage{mathtools} \usepackage{xparse} \usepackage{xcolor} \makeatletter \renewenvironment*{bmatrix}{% {\ifnum0=`}\fi \collect@body\processmatrix }{% \ifnum0=`{\fi}% } \NewDocumentCommand \...


1

This maybe doesn't all the checks as in multline, but might be sufficient for your purposes: \documentclass{article} \usepackage{amsmath} \usepackage{environ} \usepackage{xparse} \ExplSyntaxOn \NewEnviron{nmultline}{% \seq_set_split:NnV \l_nmultline_contents_seq { \\ } \BODY \seq_pop_left:NN \l_nmultline_contents_seq \l_nmultline_first_tl \...


8

The problem with \AfterEndEnvironment is that there's an extra \if@ignore\@ignorefalse\ignorespaces\fi bit of code after it. So the arguments k_k^ never reach their intended sub- and super-scripts. You can move around this with an extra argument u{\fi} (or, if you want to be more cautious, may be u{\if@ignore\@ignorefalse\ignorespaces\fi}, so it gives an ...


5

From the amsmath documentation (section 15.2 Implementing tags and labels, p 39): Sometimes it is necessary for a \tag command to store a tag in a safe place and to process it later, e.g., for a tag in a row of an alignment where the tag can only be typeset when the \\ at the end of the row was seen. Such a tag is stored in the macro \df@tag (for ‘...


4

The behaviour of \refstepcounter in equation and align (for example) is different in the sense that in equation the \incr@eqnum command (a wrapper for \refstepcounter etc.) is used right at the start of the environment, so \storelabel can access \@currentlabel in align however, the \storelabel command is used before the tag is set, i.e. \@currentlabel is ...


5

The problem is in the & tokens in the subsidiary environment, that should be protected from the outer environment. One of Knuth's dirty tricks that's often used in LaTeX is available. \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand{\@MatrixWithoutBracs}[1]{% \begin{matrix} #1% content \end{matrix}% } \...


0

Here is another solution using \halign: \def\pdig#1#2#3#4#5#6#7#8#9{[#1] [#2] [#3] [#4] [#5] [#6] [#7] [#8] [#9]} \def\trule{\vrule height10pt depth4pt\relax} \vbox{\offinterlineskip\halign{\hfil#\hfil\trule\ &\pdig#\cr $+_9$ & 0 1 2 3 4 5 6 7 8 \cr \noalign{\hrule} [0] & 0 1 2 3 4 5 6 7 8 \cr [1] & 1 2 3 4 5 6 7 8 ...


2

The linebreak thinks the [1] (or whatever) that follows is an optional argument, unless you tell it to stop. \documentclass{article} \begin{document} \begin{center} \begin{tabular}{ c|c c c c c c c c c } $+_9$ & [0] & [1] & [2] & [3] & [4] & [5] & [6] & [7] & [8] \\ \hline [0] & [0] & [1] & [2] & [3] & ...


5

The problem is the internal usage of the array environment by amsmath's pmatrix. At some point \array{*\c@MaxMatrixCols c} is executed which prepares a table with MaxMatrixCols columns (default is 10). (This makes it that you do not have to insert the number of columns in your table/matrix on your own. Some work around it is done to ensure that the ...


3

This should be the right approach: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} F\colon & X \rightarrow Y \\ & x \mapsto 2x \end{align*} \end{document} If you prefer a different alignment move the &: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} F\colon X & \...


0

I am not sure what you mean by |, but for aligning equations, the align-environment is often used. Here it will align at the arrow since I put & right in front of the \Rightarrow. This is explained further in the documentation. Note that you can always locate the documentation using the command-line/terminal by writing texdoc amsmath, and that works for ...


6

I use the orignal command, add color to the brace \color{red}\left\lbrace\normalcolor, move back one space, make a hyperlink on that space \hyperlink{sec:cases}{\hspace{-1em}\ }, then move forward \hspace{1em}. It seems to work. \expandafter\newif\csname ifGin@setpagesize\endcsname \documentclass{article} \usepackage{amsmath} \usepackage{hyperref} \...


2

I wouldn't recommend it, but if luatex is an option, it allows both these errors to be disabled without making any changes to the macros. \suppressmathparerror = 1 \suppresslongerror = 1 \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} Empty are not allowed. \end{align} $$ Empty lines are not allowed $$ \end{document}


1

This is an answer for first version of the question. You are seeking problems. Partial solution, working for $$, but not amsmath-based environments is below. Check it, please and never use it. \documentclass{article} \usepackage{amsmath} \begin{document} \let\normalpar=\par \def\par{\ifmmode \else\normalpar \fi} \begin{align} Empty % are not allowed. \end{...


6

Andrew Swann’s solution was the second thing I too had vaguely thought of (but, of course, it is one thing to have a vague intuition, and another to turn it into working code!), My first idea, however, was to try to implement the desired behavior at the level of TeX primitive commands. The purpose of this answer is simply to provide a sort of proof of ...


10

One can try and adapt your solution How to color delimiters, which is based on collecting the material and using it in a \vphantom. The amsmath package has the convenient \collect@body to help with this, but you also need to use the \ifnum0 trick of Knuth as in http://tex.stackexchange.com/a/319031/15925 to avoid grouping problems when this is used inside ...


1

You could use the \substack macro of the amsmath package. Compared with the array method used in your example, the material in the argument of \substack is automatically set in \scriptstyle. Also, do abbreviate "such that" to "s.t.". \documentclass{article} \usepackage{amsmath} % for \text and \substack macros \begin{document} \[ D_{k+1}(x_{k+1}) = \...


0

\documentclass{article} \usepackage{amsmath} \begin{document} \[ \hat{y}_i= \begin{cases} y_i, & \text{if}\ i\notin I\\ (x\hat{\beta})_i, & \text{if}\ i \in I \end{cases} \] \end{document}


2

You can't use _ in the argument to \text. You should better use \mathrm and \xrightarrow: \documentclass{article} \usepackage{amsmath} \usepackage{siunitx} \begin{document} \begin{equation} 2I_{x}S_{z} \xrightarrow{\ang{90}\ \mathrm{Pulse}_{I_y}} \end{equation} \end{document}



Top 50 recent answers are included