Tag Info

New answers tagged

1

Don't use $$, it's plain-TeX syntax and does not have the flexibility, for example, to move the equations automatically to the left. Don't use $$, ... Don't use $$, ... The formatting of $$ is hard-coded in TeX, thus to change its behavior for automatic left-aligning, the source code of TeX needs to be changed. With extra TeX code, also $$...$$ can be ...


1

Is fleqn what you are looking for? (By the way, I rewrote the code in a more clear way, at least to me) \documentclass[fleqn]{scrartcl} \usepackage{mathtools,amssymb} \usepackage{kantlipsum} % Just for this example (the \kant command) \begin{document} \kant*[1] \[ f(x) = \frac{\sin^2 x \cos x}{\sin x + \cos x} - \frac{1}{4} ...


0

There is another package for this task not yet mentioned: stackrel. It adds an optional argument to the LaTeX \stackrel command to set something below the relation, as in \usepackage{stackrel} \usepackage{amssymb} $$\stackrel[c]{e}{\leftrightarrows}$$


1

Are you using the arrows to show a chemical reaction? Then you might be interested in knowing that you can use the mhchem package which simplifies writing reactions. It gives the same result as Amar's code but you don't have to include all the extra definitions yourself. I used the option arrows=pgf to get arrow heads more like the ones in your picture. ...


2

Here is another solution with tikz-cd: % arara: pdflatex \documentclass{article} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd} A \arrow[shift left=2pt]{r}{e} & B\arrow[shift left=2pt]{l}{c} \end{tikzcd} \] \end{document} And yet another one with unicode-math and substack: % arara: lualatex \documentclass{article} ...


1

I have found five possible ways to do this, out of which 2 match your requirements; however, the arrows are not extensible in those! Further information can be found in the code itself. Note: No matter which method you choose the alignment just isn't right in all of them! \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} ...


2

This may not be the best solution (spacing seems off to me), but you can turn \leftrightarrows into a math operator and turn on limits: \documentclass{article} \usepackage{amssymb} \newcommand\weird{\mathop\leftrightarrows\limits} \begin{document} $\weird^3_f$ \end{document}


0

To follow-up the discussion in the comments of David Carlisle's answer about the unicode-math package: In LaTeX, there are two fonts in math mode: one for letters (variables), usually called math font (better called math letter font); one for words, usually called math text font (better called math word font), and one text font in text mode, usually ...


2

\documentclass{scrartcl} \usepackage{mathtools,mleftright} \mleftright % Or comment this line and use \mleft and \mright instead \begin{document} $f\left(x\right)$ $\arg\left(z\right)$ $e^{i\arg\left(z\right)}$ \end{document}


5

The following example redefines \vdots and \ddots to get a resizable version according to the current math style. The vertical space between the dots is taken from the horizontal dots. Also the dots in \ddots match the vertical spacing of \vdots and the horizontal spacing of the horizontal dots in \cdots. \cdots adds a thin space at the right side. For a ...


2

You are missing one additional$...$ pair: \documentclass{article} \usepackage{mathtools} \newcommand{\svdots}{\raisebox{3pt}{$\scalebox{.75}{\vdots}$}} % <- Works \newcommand{\sddots}{\raisebox{3pt}{$\scalebox{.75}{$\ddots$}$}} % <- Do not work \begin{document} \begin{equation*} \begin{bsmallmatrix} a_{11} & a_{12} & \cdots & ...


1

I have found that Latex has a symbol for a star which is the command \bigstar. http://latex.wikia.com/wiki/List_of_LaTeX_symbols So using the follow the $\mathbf{A}_k^{\bigstar}$ produce $$\mathbf{A}_k^{\bigstar}$$


4

MWE: \documentclass[11pt]{article} \usepackage{amsmath} \begin{document} \begin{equation*} Q = \begin{pmatrix} -(\lambda_1 + \mu_1) & \lambda_1 & 0 & \ldots & 0 & 0 \\ 0 & -(\lambda_2 + \mu_2) & \lambda_2 & \ldots & 0 & 0 \\ \vdots & \vdots & \vdots & \ldots & 0 & 0 \\ 0 & 0 ...


3

you should really have posted these as two separate questions, instead of adding on to the first. but you could try \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} \mathbf{q}=(\mu_1, \mu_2, \ldots ,\mu_{n-2}, \mu_n )^{\text{T}} \label{2} \end{equation} and \begin{equation} L = \log(l) = ...


5

Example, how this can be typeset: \documentclass[a5paper]{article} \usepackage{amsmath} \newcommand*{\transpose}{\mathrm{T}} \newcommand*{\vc}[1]{\mathhbf{#1}} % \vec and \vector are already defined \begin{document} \begin{equation} \label{q-def} \vc{q} = (\mu_1, \mu_2, \dots, \mu_{n-1}, \mu_{n})^\transpose \end{equation} Equation~\eqref{q-def} ...


17

in latex.ltx there is a line \let\sp=^ so there is an alternate command, \sp, that will produce a superscript. @egreg notes in a comment that this isn't available for mathjax, so it's apparently not "portable". however, david cervone (mathjax lead developer) says that MathJax does handle \let\sp=^ [...]. MathJax's \let only works to set a control ...


1

\documentclass{article} \begin{document} \[ \in \mbox{and} \ni \] \end{document} The symbol can be found in "Table 139: Letter-like Symbols" of The Comprehensive LaTeX Symbol List.


4

Try this: \documentclass{beamer} \usefonttheme[onlymath]{serif} \begin{document} \begin{frame} Here goes the text $x + y = Z$ \end{frame} \end{document}


3

Define a new symbol font using the font of newtxmath and tell TeX to take \gamma from it. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{tgtermes} \usepackage{amsmath,amsfonts} \usepackage[zswash,lite]{mtpro2} \usepackage{bm} \DeclareSymbolFont{newtxletters}{OML}{ntxmi}{m}{it} \SetSymbolFont{newtxletters}{bold}{OML}{ntxmi}{b}{it} ...


21

TeX will not break a line at the “control space”, because it's allowed to break lines in formulas only after binary operators such as + or =. Glue in math mode is not an allowed break point. The spaces in $a,\ b$, and $c$ will be different, because TeX adds a thin space between a punctuation atom (the comma) and an ordinary atom (the ‘b’), independently ...


28

Yes it matters. In the first case the comma is from the math font, and depending on your math setup can be different from the text font. So you should make sure that all commas are either from text or math and not mixed. Which one is better depends on the context, in a normal sentence I would use the text comma. \documentclass{article} ...


8

The use of math alphabet commands in unicode-math is somewhat broken there are open issues at github which mentions \mathit but \mathrm is the same. You can redefine \mathrm to use the Roman text font as follows: \documentclass{article} \usepackage{unicode-math} \setmathfont{Latin Modern Math} \setmathfont[range=\mathup]{Latin Modern Roman} ...


1

\documentclass{article} \usepackage{amsmath} \begin{document} \[ A \in R^{M \times K_{0,}} \] \[ u = [u_1,\dots,u_{K_0}]^T \] \[ \min\sum^{K_0}_{i=1}(u_i+v_i), \text{ s.t. } [A,-A][u^T,v^T]^T = y, u \geq 0, v \geq 0, \] \[ \mathit{Ind}^{(n)}_+ \text{ and } \mathit{Ind}^{(n)}_- \] \[ \mathit{IND}^+_k = ...


0

My solution is a little easier and a lot sketchier. The symbols appear as accents in the tipa package (which works in textmode), so when used as punctuation they had questionable spacing, which I modified using equally questionable methods: \usepackage{tipa} \newcommand{\lquine}{\textopencorner\hspace{-1pt}} \newcommand{\rquine}{$\,$\textcorner$\ $}


3

You can use empheq \documentclass{article} \usepackage{empheq} \begin{document} \begin{empheq}[left={\alpha(x)= \empheqlbrace}]{align} & x\\ & \frac{1}{1+e^{-kx}}\\ & \frac{e^x-e^{-x}}{e^x+e^{-x}} \end{empheq} \end{document}


7

This is expected, because the period has type \mathord, so it doesn't change with \mathXY commands. However, it's easily fixed. \DeclareMathSymbol{.}{\mathalpha}{operators}{`.} For the comma it's not as easy, because we can't assign the comma the \mathalpha type, since it should be punctuation. It's easier to use sansmath, that also makes sans serif many ...


2

spanish from babel, defines a particular macro to alter the output of a decimal point (i.e., you input, as always, a dot ., and you change the output with this macro). \usepackage[spanish]{babel} \spanishdecimal{\textsf{,}} Personally, I like the dot itself, so \spanishdecimal{.} would do for me (there are other concrete macros for the dot or the comma, ...


3

Are you aware of sansmath option of MyriadPro? \documentclass[11pt]{scrbook} \usepackage[utf8]{inputenc} \usepackage{MinionPro} \usepackage[sansmath]{MyriadPro} % \usepackage[onlysansmath]{mdsymbol} % \usepackage{sansmath} \begin{document} {\sffamily\mathversion{sans}% <===== This should be sans-serif, but the math isn't: $E=\hbar\omega$} This should ...


14

You have several options. A comment up front: \mathrm isn't among your options, as you'd have to manually insert interword space markers. (Aside: I would also insert thinspace directives after the opening curly brace and before the closing curly brace.) "Basic LaTeX": \mbox $\{\, n \mid n \mbox{ is even} \,\}$ With the amsmath package loaded: \text ...


1

I adapted my recent answer at Create itemize-like command, and actually prefer its look to what the OP asks here. Nonetheless, I have adapted it to look more in a manner the OP has specified. The default \leftmargin is .4\textwidth, but that can be overridden with an optional length argument to the explanation environment. Other changes from the ...


2

Another solution: \documentclass{article} \usepackage{mathtools} \usepackage{array} \begin{document} \begin{align} \text{Spatial,}\quad d_p(s^i,n^{jk}) & = √{(s_x^{\vphantom{j}i} - n_x^{jk})^2} \\ % \text{and color distance component,}\quad d_c(s^i,n^{jk}) & = √{(s_L^i - n_L^{\smash jk})^2 } \\[-1ex] % with smashed j ...


6

Square roots are very sensitive to ascenders and descenders. Just look at the two of them and you'll realize that the culprit is the j in the second one: \documentclass{article} \begin{document} \begin{equation} x_{ij} = \frac{ \sum_{t}{e_i(t)e_j(t)} } { \sqrt{\sum_t{e_{i\vphantom{j}}^2(t)}} \sqrt{\sum_t{e_j^2(t)}} ...


7

\documentclass{article} \begin{document} \begin{equation} x_{ij} = \frac{ \sum_{t}{e_i(t)e_j(t)} } { \sqrt{\strut\sum_t{e_i^2(t)}} \sqrt{\strut\sum_t{e_j^2(t)}} } \end{equation} \end{document}


1

More of a workaround than a regular answer to your question: using \limits. \documentclass{article} \begin{document} \begin{equation} x_{ij} = \frac{ \sum\limits_{t}{e_i(t)e_j(t)} } { \sqrt{\sum\limits_t{e_i^2(t)}} \sqrt{\sum\limits_t{e_j^2(t)}} } \end{equation} ...


1

Maybe like this? % arara: pdflatex \documentclass{article} \usepackage{mathtools} \usepackage{blindtext} \begin{document} \blindtext Something spatial, \begin{align} d_p(s^i,n^{jk}) &= \sqrt{(s_x^{\vphantom{j}i} - n_x^{jk})^2} \\ % with phantom j \intertext{and color distance component,} d_c(s^i,n^{jk}) &= \sqrt{(s_L^i - ...


4

This is described in the babel documentation as a typical error, see section 1.5 on Shorthands. The problem is caused by the combination "}; the solution given is to add an empty pair of braces so you write "{}} instead. \documentclass[norsk]{beamer} \usepackage[utf8]{inputenc} \usepackage{babel} \usetheme{Warsaw} \begin{document} \begin{frame} ...


0

I think that using \left and \right is the best way to go, as function arguments might as well grow taller than usual. But it is a matter of taste. For myself, I have defined the following command: \newcommand{\of}[1]{\!\left({#1}\right)} This gives me nice spacing for function arguments while preserving \left's and \right's functionality, and it also ...


2

I didn't do any change in your data area, I only replaced your \begin{alignedat}{4} by \vcenter{...\haling{... and your \end{alignat} by }}. Only the \\ in the last line is added. Your aligned material is solved by simple TeX primitive \halign: \left. \vcenter{\let\\=\cr \halign{&${}#{}$&$#$\hfil\cr & I_1 &-&I_2 &-&I_3 ...


4

you can use alignedat with some small modifications. remove the ampersands following the signs of operation and relation and then double all ampersands after the first. the positioning by ampersands alternations -- right/left -- as "equalities" are assumed. if an "indented" element isn't preceded by a sign of operation or relation, then it will have to be ...


4

In this case I would use array: \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{array} \newcommand{\mC}{\mathcal} \pagestyle{empty} \begin{document} \begin{equation*} \left.\setlength{\arraycolsep}{0pt}\renewcommand{\arraystretch}{1.2} \begin{array}{l >{{}}c<{{}} l >{{}}c<{{}} l >{{}}c<{{}} l} ...


6

How to do this using normal TeX tools: \def\vec#1{{\bf#1}} \def\lrule{\leaders\hrule height3pt depth-2.6pt\hskip2em \relax} \def\Hess{\mathop{\rm Hess}\nolimits} $$ H_{f,g} {\vec a \choose \lambda} = \left[ \vcenter{\offinterlineskip \halign{\hfil$#$\ \hfil\vrule height10pt depth5pt&\hfil\ $#$\hfil\cr & | \cr \Hess(f)(\vec ...


2

Do you mean this? \documentclass{article} \usepackage{mathtools,array} \begin{document} \begin{tabular}{|c|c|} \hline $ \langle R_1.Y \rangle$ & $ \langle \dot{-}R_2.X, \dot{-}R_2.X \rangle$\\ \hline \multicolumn{1}{|r}{ $\langle a \rangle$} & \multicolumn{1}{!{\clap{$\vee$}}c|}{$\langle b,b \rangle $} \\ \hline \hline ...


7

Something like that? \documentclass{article} \usepackage{amssymb} \usepackage{mathtools, array} \DeclareMathOperator{\hess}{Hess} \def\longline{\relbar\mkern-6mu\relbar} \begin{document} \[\setlength\extrarowheight{1pt} \begin{bmatrix} \begin{array}{c@{\,}c@{\,}c|c} & & & \vrule \\ \multicolumn{3}{c|}{\hess_{f, g}(f)(\mathbf a)} ...


14

Here is how I would do it: \documentclass{article} \usepackage{mathtools} \usepackage{bm} \DeclareMathOperator{\Hess}{Hess} \newcommand*\vect[1]{\mathbf{#1}} % http://tex.stackexchange.com/a/59955/15874 % The following piece of code measures the length of math expressions % in order to get the length of the two horizontal rules (based on % the chosen ...


12

Here is an approach with an array and some \rule commands for the extra lines inside of cells. Note that the array actually consists of four rows. Code \documentclass[varwidth]{standalone} \usepackage{amsmath,bm} \DeclareMathOperator\Hess{Hess} \begin{document} \begin{equation*} \renewcommand*\a{\mathbf{a}} \newcommand*\vl{\rule[-.3em]{.4pt}{1em}} ...


4

This is fixed in today's beta (ver: 2015.05.09). The labels for \sin, \cos, etc., now use text serif font rather than math upright.


1

I show my solution for this problem for plain TeX, where amsmath.sty isn't loaded, because the first line of this macro file says: \NeedsTeXFormat{LaTeX2e}. I leaved the \skewchar calculation because this is more suitable for accents like dot. My \ẅidebar begins by left slanted border (by default) and ends at the same place as \overline. If the first token ...


4

This does it for the \alpha and \beta, for example. \documentclass{book} \usepackage{amsmath} %\usepackage{cmbright} \DeclareSymbolFont{CMB}{OML}{cmbrm}{m}{it} \DeclareMathSymbol{\alphasf}{\mathalpha}{CMB}{11} \DeclareMathSymbol{\betasf}{\mathalpha}{CMB}{12} \begin{document} \[ AB\alpha\alphasf\beta\betasf \] \end{document}


1

It's not related to the problem in the referenced question, there large entries were tight to the surrounding rows and the answer made sure that the spacing strut in those rows was larger than the entry thus preserving row separation but making the row separation more variable. It would not do anything here as the later rows are not large. Here (I think) ...


5

the two symbols aren't in the same class, so they'll invariably get some space in between. to turn an operator or a relation into an "ordinary" character, wrap it in braces. then, combine them and wrap the whole thing in braces, applying \mathbin or \mathrel as appropriate: \documentclass{article} \begin{document} \[ a \mathbin{{+}{=}} b \mathrel{{=}{+}} ...



Top 50 recent answers are included