Hot answers tagged

14 votes

Is there a way to avoid having to add \mathit to eachword in an equation?

In fine math typesetting, it's very common to use an upright font shape for operators such as "log", "sin", "det", "abs", and so on. "erf" is no ...
Mico's user avatar
  • 495k
13 votes

How to align amsmath matrices and make them look cleaner

You can first of all use align*. Also, fixed width columns make the display much more symmetric. Since I'd not use \nicefrac even under physical threat, I changed it into \nf so you can, if you really ...
egreg's user avatar
  • 1.1m
12 votes
Accepted

amsmath error: Multiple \label's: label 'xxx' will be lost

You cannot have two distinct \label commands in the same split environment. The amsmath package tweaks \label to fulfill its needs, so it is redefined inside the alignment environments. But there's ...
egreg's user avatar
  • 1.1m
12 votes
Accepted

How to properly align two numbered equations?

You can use IEEEeqnarray from IEEEtrantools. Here I specify alternating centered columns, one for ordinary material and one for relation/operation symbols. I also add a simpler syntax for the ...
egreg's user avatar
  • 1.1m
11 votes
Accepted

Height of \sin versus \tan in amsmath

You can notice that the exponent is a bit higher in \sin^2 than in \tan^2, which in turn is higher than in a^2. The height of i is larger than the height of t, but only to an extent that affects the ...
egreg's user avatar
  • 1.1m
10 votes

How to align text under the brackets

You want to make the formulas to have the same height. Here I use \mathstrut, but in the optional argument you may use any \vphantom. \documentclass{article} \usepackage{amsmath} \newcommand{\...
egreg's user avatar
  • 1.1m
10 votes

How to align text under the brackets

The reason the middle of the three underbraces isn't aligned vertically with the other two is that the first argument of the associated \underbrace directive doesn't contain material that protrudes ...
Mico's user avatar
  • 495k
9 votes

Why do amsmath and \char interact in this way?

\char is the TeX primitive to access a character by number, so redefining that will break all kinds of latex constructs, not just amsmath \documentclass{article} \renewcommand{\char}{\stepcounter{...
David Carlisle's user avatar
9 votes

Stretch accent over fraction

I would like to suggest that you use \overbrace instructions instead of \accentset directives. In the code below, I also use a couple of \vphantom instructions, which insert typographical struts, to ...
Mico's user avatar
  • 495k
9 votes

Height of \sin versus \tan in amsmath

You have already gotten ideas on how to get around it, so let me just elaborate a bit. (This is too long for being a comment.) This is a nice example where several things coincide. The radical come ...
mickep's user avatar
  • 8,445
9 votes

How to properly align two numbered equations?

In your case you could use the eqparbox package for example. It helps to make pairs of boxes of the same width. After making them, it is sufficient to use simple `align' for your equations to be ...
Sergei Golovan's user avatar
8 votes

Comma in amsmath breaks line

Never ignore error messages. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} B_i_$, $ _j = \begin{cases} 1$, $& \text{if } P_i_$,$_j\geq 1\\ 0$, $& \text{...
David Carlisle's user avatar
8 votes
Accepted

Incompatibility between babel spanish and russian?

This is a bug that has been hidden for a couple of decades. Both the Spanish and Russian modules for babel want to define “local” math operators, because of tradition. In the past, with your setup, ...
egreg's user avatar
  • 1.1m
8 votes
Accepted

Two matrices of same height, but different number of rows

Here is a solution with the environment {NiceArray} of the package nicematrix. In that environment, you merge cells with the command \Block both vertically and horizontally. \documentclass{article} \...
F. Pantigny's user avatar
  • 38.5k
8 votes
Accepted

Dot derivative of vector that includes a hat misaligns

amsmath is working hard to enable a dot accent over a hat accent. You can reset things inside \dot so it "forgets" it is in a nested accent construct. \documentclass{article} \usepackage{...
David Carlisle's user avatar
8 votes
Accepted

Displaying blackboard bold characters in LaTeX

Using the canonical amsmath and amssymb. \documentclass[11pt]{article} \usepackage{amsmath, amssymb} \begin{document} The blackboard bold letters $\mathbb{ABCDEFGQRZ}$ \end{document}
Sebastiano's user avatar
  • 52.7k
8 votes
Accepted

Calligraphic style Math Font for letter Q

Using newtxtext and newtxmath packages to obtain the similar image below. %% Compile and read me! \documentclass[a4paper,12pt]{article} \usepackage{newtxtext,newtxmath} \begin{document} \begin{...
Sebastiano's user avatar
  • 52.7k
8 votes
Accepted

Properly creating a boxed vertical vector of math symbols in TikZ

All AMS alignments have a ...ed form that is set natural width rather than being a full width display, so you can avoid minipage with gathered \documentclass[tikz,dvipsnames]{standalone} \...
David Carlisle's user avatar
8 votes

Titlespacing command not working for \subsection and also causing error for \section

You get ! Undefined control sequence. <argument> ...on\endcsname \protect \@secnumpunct l.9 \section{Main section} % <- This line triggers the error ? ! Undefined ...
egreg's user avatar
  • 1.1m
7 votes

Comma in amsmath breaks line

I guess you want something like Pi,j so the correct syntax would be P_{i,j} Certainly $,$ in that context is an error (and I can't think of situations where it would be correct, even if syntactically ...
egreg's user avatar
  • 1.1m
7 votes
Accepted

cube shape in Latex Math

The fontawesome package has the symbol \faCube, which must be used in text-mode (not math mode): \documentclass{article} \usepackage{fontawesome,amsmath} \begin{document} $f_{\text{\faCube}}$ \...
Sandy G's user avatar
  • 39k
7 votes
Accepted

`sfrac` with fraction numerator and denominator

The sole purpose of using \sfrac is to typeset fractions more compactly than is possible with \frac. Using \dfrac in the arguments of \sfrac flies in the face of using \sfrac to begin with. If you ...
Mico's user avatar
  • 495k
7 votes
Accepted

nicematrix: add ttfamily in the last-col

UPDATE The latest version of nicematrix (v. 6.16) provides the ability to put directly the delimiters \lgroup and \rgroup (via \left\lbroup and \right\rgroup) in the preamble of an environment such as ...
F. Pantigny's user avatar
  • 38.5k
7 votes
Accepted

Why do amsmath and \char interact in this way?

tl;dr Is it possible to safely redefine \char? Not without a lot of work that would prove useless. Never do \renewcommand on a command you don't know about. For your command do \DeclareMathOperator{\...
egreg's user avatar
  • 1.1m
7 votes
Accepted

Vertical alignment of \underset

(I've edited this answer to mention the \overunderset macro, which has the same issue as a nested combination of \overset and \underset.) It would appear that \rightleftarrows is programmed to think ...
Mico's user avatar
  • 495k
7 votes
Accepted

Special alignment of equations in an optimization problem

Note that y(b) is narrower (width-wise) than y(a) and J(y) (where the latter is the widest element that is used to align the relations). However, aesthetically, it's probably better to align the y's ...
Werner's user avatar
  • 598k
7 votes

How to have two & in align?

I would like to suggest you employ an alignat{2} environment. Do note that I wrote \mathopen] 0,\infty \mathclose[ rather than just ] 0,\infty [. This brings about an improved, i.e., larger, amount ...
Mico's user avatar
  • 495k
7 votes

Writing multiline equation in align environment -> integrals become smaller?

Instead of inserting a number of \displaystyle directives ahead of \int statements in the denominators of various fractions, one could define a variant form of \frac called, say, \ddfrac -- short for &...
Mico's user avatar
  • 495k
7 votes
Accepted

Adjusting the height of math floor symbol

TeX uses a discrete set of five bracket sizes (not counting the massive brackets around matrices, etc.). Using \left and \right invokes an algorithm that calculates which to use, based on what appears ...
Ian Thompson's user avatar
  • 43.3k
6 votes
Accepted

Three-line intersection symbol

There really isn't enough room inside \Cap to fit a third cap, so here is a built-from-scratch solution using TikZ. At present not available for use in subscripts, but that could be done using \...
Sandy G's user avatar
  • 39k

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