Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

13

With the last LaTeX release (October 2019) a lot of commands which are not usually supposed to expand were made robust, so \ne, which usually was \not=, now expands to \protect\ne<space> (\ne<space> is \csname ne \endcsname). With \let\OldNe\ne, when your command does \mathrel{\OldNe}, \OldNe expands to \protect\ne<space>, and now \ne<...


9

Not quite elegant but works \documentclass{article} \usepackage{amsmath} \begin{document} \begin{flalign} \rlap{$\displaystyle\overbrace{\phantom{f = \sum_{i\in I} a_i}}^{\text{ my notes }}$} f &= \sum_{i\in I} a_i \\ g &= blabla \\ h &= blabla \end{flalign} \end{document} Basically you put the expression with the \overbrace in a box ...


9

As Sigur points out, there is a hierarchical difference in the script positions of the 1. However, if you wanted, in general, to not differentiate the size difference between a script and the script-of-a-script, you could use \DeclareMathSizes: \documentclass{article} \DeclareMathSizes{10}{10}{7}{7} \begin{document} $\left(V_i^{L^{(1)}}, K_i^{\mathcal{N}^{(...


5

As @Zarko has already noted in a comment, your objective won't succeed in keeping the typeset material within the document's margins unless they are quite narrow. Even if it does fit -- see the use of \hphantom in the first equation* environment, again as per @Zarko's suggestion -- the resulting look is quite "off balance". I can't say it looks better than ...


5

A slightly modified version of my previous answer, in which all parameters are stored in keys, allows you to do that: just add two bars on top of two Is at different heights. The syntax is now such that you can optionally modify all parameters on the fly, h is the relative height, w is the fraction of the width, s is a shift that can be positive or negative ...


5

Bit of a cheat, but as all the lines have standard height \documentclass{minimal} \usepackage{mathtools} \begin{document} \begin{align*} f \colon \{\,\text{long expr}\,\} &\rightarrow B\\ \left\{ \begin{aligned} a_1 \\ a_2 \end{aligned} \right.& \begin{aligned} &\mapsto b_1\\ &\mapsto b_2 \end{...


5

The comments in amsmath.dtx say: % The code for calculating the appropriate placement of equation % tags in the \env{align} environments is quite complicated and % varies wildly depending on the settings of the |tagsleft@| and % |@fleqn| switches. To minimize memory and hash space usage, we % only define the variant appropriate for the ...


4

Here's a solution that uses nested array environments. \documentclass{article} \usepackage{newtxtext,newtxmath,array,amsmath} \begin{document} \[ \begin{array}{r@{\,}l} f\colon\{\text{ long expr }\} & \to B \\ \left\{\begin{array}{@{}r@{}} a_1 \\ a_2 \end{array}\right. & \begin{array}{@{}l@{}} \mapsto b_1 \\ \mapsto b_2\end{array} \end{array} \] \...


4

It is not clear, what you like to achieve. I guess that you like to align your math expressions at two points. This you can do with use of the array or with alignat environments: \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} \begin{alignat*}{3} 0 & < t_n - a & < \delta\\ -\delta & < a - t_m & < 0 \...


4

It should be \hbox{$\scriptstyle#1$}. However, there's a better way: \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand{\oset}[2]{{\mathpalette\o@set{{#1}{#2}}}} \newcommand{\o@set}[2]{\o@@set{#1}#2} \newcommand{\o@@set}[3]{% \vbox{\offinterlineskip \ialign{\hfil##\hfil\cr $\m@th\o@set@demote{#1}#2$\cr \noalign{\vskip0....


4

I propose another layout, with medium-sized fractions from nccmath and an alignment of the sum symbols, thanks to the pmatrix* environment from mathtools and package eqparbox: \documentclass{book} \usepackage{mathtools, nccmath} \usepackage{bm} \usepackage{eqparbox, booktabs} \newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\scriptstyle#2$}} \newcommand{\msum}{...


4

Use always \dfrac and \limits: \documentclass{book} \usepackage{amsmath} \begin{document} \begin{equation} \begin{pmatrix} \sum\limits_{j=1}^{q_{k}} \dfrac{\vec{e}_{k,j}}{b_{k,j} - \vec{m}_{k,j}^T \vec{x}_{k} - \vec{e}_{k,j}^T \vec{u}_{k}} \\ \sum\limits_{j=1}^{q_{k+1}} \dfrac{\begin{pmatrix} \vec{e}_{k+1,j} & \...


3

For simple applications you could just add rules. \documentclass{article} \usepackage{amsmath} \newcommand{\UnderlineWithBorders}[1]{\setbox0\hbox{#1}% \rule[\the\dimexpr-0.37ex-\dp0]{0.1ex}{0.3ex}\underline{#1}\rule[\the\dimexpr-0.37ex-\dp0]{0.1ex}{0.3ex}} \begin{document} \UnderlineWithBorders{ABC} \UnderlineWithBorders{ijk} \end{document} For a more ...


3

As long as there is no left-hand material in any line but the first, what is requested can be accomplished easily by applying \mathrlap (\usepackage{mathtools}) to the right-hand side of all other lines: \begin{equation*} \text{centered example line} \end{equation*} \begin{equation*} \begin{aligned} \cos^{-1}{x} &= \sin^{-1}{\frac{1}{3}} + \sin^...


3

How about \documentclass{article} \usepackage{amsmath} \newcommand{\mybar}[1]{\setbox0\hbox{$\boldsymbol{#1}$}% \makebox[\the\wd0][c]{% \rule[0.42\ht0]{0.75\wd0}{0.7pt}}\hspace*{-\the\wd0}\boldsymbol{#1}} \begin{document} $a=\mybar\Upsilon+b+5\mybar{Z}+2$ \end{document} At the moment, the bar is attached at 42% of the height of the character (0.42), it is ...


2

Remember: it is possible to use also mtpro2 (I like very much this package), lite version. Here there are several examples in relation to your tastes for the lenghts of the tilde symbol. The vertical spacing is automatic. \documentclass{article} \usepackage[lite]{mtpro2} \begin{document} \[ \tilde t+\wtilde t +\wwtilde t+\widetilde t \] \end{document}


2

Not sure what you want exactly. I propose this, with stackengine: \documentclass[border = 2pt]{standalone} \usepackage{graphicx, stackengine} % \usepackage{amssymb, rotating, relsize} \newcommand{\barUpsilon}{\stackMath\mathord{\stackinset{c}{0ex}{c}{-0.45ex}{\scalebox{0.8}{$ \relbar $}}{\Upsilon }}} \newcommand{\barZ}{\stackMath\mathord{\stackinset{c}{...


2

Here's a customizable implementation that can also be adapted to other fonts. Some visual experimentation is necessary, because different fonts will have different shapes for the letters. The second argument to \addbar specifies a shift factor in units of the symbol's width. \documentclass{article} \usepackage{amsmath,bm} \newcommand{\barredUpsilon}{\...


2

I've seen that the main problem is that you are using pmatrix environment inside another pmatrix environment. That's causing the differences in sizes between the numerator and denominator. One solution, if you don't fully understand the code that you have with the pmatrix, is to use plain arrays. You can create an array of one column, and every entry in ...


2

What you obtain is normal: when you have several alignment points, all alignment columns, but the first, have to be introduced by an ampersand, and inside this column, the alignment point is specified by a second ampersand, so that two alignment points require 3 ampersands. If the last one is missing, it is implicitly added at the end of each row, so that ...


2

After 20 minutes I have created this MWE, more ugly ( :-) ) than the answer of @campa ...but also it works. \documentclass[a4paper,12pt]{article} \usepackage{mathtools} \begin{document} \[ \begin{matrix} \mathclap{\overbrace{f = \displaystyle \sum_{i\in I} a_i }^{\text{my notes}}} \\[2ex] g= \phantom{\displaystyle \sum_{i\in I} a_i} \...


1

You can use an inline math with a nested aligned ...& $\begin{aligned}[t] a&b... \end{aligned}$ ...


1

You can have what you want with \AtBeginEnvironment from etoolbox and \useshortskip from nccmath (to be loaded before mathtools): \documentclass{article} \usepackage{nccmath, mathtools} \usepackage{etoolbox} \AtBeginEnvironment{align}{\useshortskip} \AtBeginEnvironment{align*}{\useshortskip} \begin{document} \section{Foo} \noindent\rule\textwidth{0.6pt} \...


1

Did you see an example somewhere? Detexify yields nothing (with my drawing skills; maybe you could draw an "official" sketch?). Shapecatcher finds this: http://shapecatcher.com/unicode/info/294 http://shapecatcher.com/unicode/info/10726


1

Why not use the \accentset command? \documentclass{article} \usepackage{amsmath, amssymb} \usepackage{accents} \begin{document} $\accentset{\sim}{t}$ compared to $ \tilde{t} $ and to $\widetilde{t}$ \end{document}


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