Hot answers tagged

37 votes

What is the Latex convention for sign function?

The question of whether to use "sgn" or "sign" is not entirely subjective: the ISO 80000-2 standard says it should be "sgn".
Daniel Hatton's user avatar
34 votes
Accepted

Real Number Symbol \R not working

\R is not a predefined command, you need to define it yourself if you want to use it as a shortcut. \newcommand{\R}{\mathbb{R}} Thus: \documentclass{article} \usepackage{amsmath} \usepackage{...
Au101's user avatar
  • 10.3k
33 votes
Accepted

Why "p" in pmatrix?

The amsmath package provides a number of options. The leading letter before matrix indicates the delimiter that is used: p for parens, b for brackets, v for verts, B for braces, V for double verts. ...
Steven B. Segletes's user avatar
30 votes
Accepted

Big O notation - visual difference related to document configurations

Just revert \mathcal to using Computer Modern Symbols: \documentclass{article} \usepackage{fourier} % add these two lines to your long preamble \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} \...
egreg's user avatar
  • 1.1m
27 votes

Spacing of math symbols to the left of a letter and between two letters

You ask, Is there a reason for these spacing[s] to be different? Indeed there is! What you've (re-)discovered is the difference between - (and + too) being employed as either a unary or a binary ...
Mico's user avatar
  • 496k
25 votes
Accepted

How to use lineno with amsmath align?

The lineno package is not compatible with the amsmath environments, but the two can be made to work together. Without the mathlines option to lineno (which turns on line numbering inside equations) ...
Circumscribe's user avatar
  • 10.8k
23 votes

Interior of a set notation

The latex kernel contains the \mathring accent for that: Edit : You might prefer to use the \ring command from mathabx. Here is a code to use it without replacing all maths fonts: it defines the \...
Bernard's user avatar
  • 270k
23 votes
Accepted

How the `\alignat` works in ams package

I've always found the description of alignat based on the number of & tokens confusing. It's simpler than that: first you decide how many parts your alignment consists of, then adjust the number ...
egreg's user avatar
  • 1.1m
23 votes

Math: overwrite \int command

Use the relevant option in amsmath: \documentclass{article} \usepackage[intlimits]{amsmath} \begin{document} \[ \int_{a}^{b} f(x)\,dx \] \end{document}
egreg's user avatar
  • 1.1m
22 votes

Why doesn't lineno number a paragraph when it is followed by an indented equation?

Mathematics environments need to be wrapped by \begin{linenomath*} and \end{linenomath*} as mentioned in Bamzi's answer. A quick way to change all your equations is to renew the equation environment ...
R.M's user avatar
  • 321
22 votes
Accepted

Is there any way to speed up typing a math symbol which has an argument, symbol^(variable)?

If \s isn't already defined as a macro, you could define it via \providecommand{\s}[1]{s^{(#1)}} and then write $\s1, \s5, \s P, \s{L-1}$ in the body of the document to generate
Mico's user avatar
  • 496k
21 votes
Accepted

Is eqnarray really obsolete?

The output of eqnarray is wrong anyway and there's little to do about it. Consider also that it doesn't work with cross-references if hyperref or cleveref are involved. No, there's no reason for ...
egreg's user avatar
  • 1.1m
21 votes
Accepted

How to avoid page breaks locally in aligned equations, with \allowdisplaybreaks enabled

\documentclass{article} \usepackage{amsmath} \allowdisplaybreaks \begin{document} Text \vspace{52em} \begin{align*} & a long formula \\* % the \\* command prohibit a page break after a given ...
Zarko's user avatar
  • 293k
21 votes

How to make the matrices look constant throughout?

The package nicematrix can compute for you the width of the widest entry of all the matrices in a portion of your document and give that width to all the columns. For that, you have to use the ...
F. Pantigny's user avatar
  • 38.5k
21 votes
Accepted

Interesting recursive behaviour with \frac error

To understand what is going on, let us consider an example that is a bit simpler. Define \macro to be a macro taking one argument \newcommand\macro[1]{abc} The argument is ignored and the expansion ...
Henri Menke's user avatar
20 votes

What is wrong with the $f$ symbol?

The cmmi10 font (and this is followed by lmmi10) has specifically a kerning between d and f: (CHARACTER C d (CHARWD R 0.520488) (CHARHT R 0.694445) (COMMENT (KRN C Y R 0.055555) (...
egreg's user avatar
  • 1.1m
19 votes

How to neatly space the equals sign when using probabilities?

I turn my comment to an answer since I think it is an adequate solution, in particular in this situation, and it is simpler than the other approaches. I also find no flaw in its visual appearance. It ...
gernot's user avatar
  • 48.7k
19 votes
Accepted

Combinatorial notation (\choose) not working with \frac

This is one of the reasons why using the \choose method is not the best. What happens? When \frac is expanded, it looks for two arguments, which in your case are determined to be {200 \choose 11}{ 200 ...
egreg's user avatar
  • 1.1m
19 votes
Accepted

What is the difference between \cdots and \dotsm?

\cdots is defined in the LaTeX format. \dotsm is an alias in amsmath, defined as \let\dotsm\cdots So, \cdots and \dotsm are identical.
David Carlisle's user avatar
18 votes

Writing math formula in LaTeX, 'undefined control sequence'

You have \nablaf which is probably undefined, I guess you wanted \nabla f (Please always post a complete document that generates the error, it is much easier to debug then)
David Carlisle's user avatar
17 votes

Square version of \cdot (small black square)?

There are several ways for doing this. One idea could be \centerdot from amssymb, but this has the defect of sitting on the baseline, despite its name. One can fix this by observing that the apparent ...
egreg's user avatar
  • 1.1m
17 votes

How to convert all fractions from the form m/n into the form\dfrac{m}{n}?

If the supplied file is saved as f.tex \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \begin{document} \[ m/n + p/q = 2/3 . \] I want \[\dfrac{m}{n} + \dfrac{...
David Carlisle's user avatar
17 votes

Ugly matrices to fix

The package nicematrix has a feature dedicated to that problem. In an environment {NiceMatrixBlock}, all the matrices created by nicematrix (with {bNiceMatrix} but this environment will create the ...
F. Pantigny's user avatar
  • 38.5k
16 votes

Square version of \cdot (small black square)?

Handcraft it. \documentclass{scrartcl} \newcommand*\sq{\mathbin{\vcenter{\hbox{\rule{.3ex}{.3ex}}}}} \begin{document} $f$ by $\bar f$ gives $\bar f \sq f \simeq c$ for $c$ the constant\dots \end{...
Manuel's user avatar
  • 27k
16 votes
Accepted

amsmath is now latex-amsmath: what does this mean for me?

No difference at all, you may not have noticed but earlier in the year the latex graphics package catalogue entry similarly changed to latex-graphics. This is simply a matter of organising the ...
David Carlisle's user avatar
16 votes
Accepted

\dots plus \left

UPDATE this is fixed in release 2.15d (sent to ctan today, 2016-06-28, so will be reaching distributions is a few days.) This is a bug (sorry ask @egreg who did it:-) until a fix is made available ...
David Carlisle's user avatar
16 votes
Accepted

reading through the definition of `\cfrac` in AMSMath

\newcommand{\cfrac}[3][c]{... defines a command with two mandatory arguments and one optional so the use is \cfrac{a}{b} or \cfrac[r]{a}{b} with the former being equivalent to \cfrac[c]{a}{b}. \ifx ...
David Carlisle's user avatar
16 votes
Accepted

How to neatly space the equals sign when using probabilities?

It's straightforward to define a macro such as \newcommand\myeq{\mkern1.5mu{=}\mkern1.5mu} -- choose the argument of \mkern to suit your personal preferences -- and thus to rewrite your equation as \...
Mico's user avatar
  • 496k

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