Tag Info

New answers tagged

1

Here is an option using \underbrace: \documentclass{article} \usepackage{amsmath} \newlength{\lwidth} \newlength{\rwidth} \begin{document} \begin{align*} \underbrace{\mathstrut zabc}{} + defg + \underbrace{\mathstrut hijklm} &= n \\[-4\jot] \settowidth{\lwidth}{zabc}% Left \underbrace width \settowidth{\rwidth}{hijklm}% Right \underbrace width ...


0

Not perfectly but close to: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation*} \begin{aligned} &\underbracket{ax} + by + \underbracket{cz} = d \\[-14pt] &\hphantom{a\!}% \underbracket{\hphantom{a+ by+ c}} \end{aligned} \end{equation*} \end{document} ...


6

Based on my answer at How to link two terms in math mode, use \ubar{left}{middle}{right}{undertext} where each term is taken in math mode, including the undertext. The parameters \rldp, \rlht, \rlwd, and \rlbr can be altered to affect the appearance. \rldp is the depth of the primary horizontal underbar \rlht is the height of the vertical struts, both ...


4

If package amsmath is loaded, then it uses \tagform@ for the formatting of the equation number: \documentclass{article} \usepackage{amsmath} \makeatletter \def\tagform@#1{\maketag@@@{[\ignorespaces#1\unskip\@@italiccorr]}} \makeatother \begin{document} \begin{equation} \label{eq:y=2x} y = 2x \end{equation} Equation \eqref{eq:y=2x}. \end{document} ...


7

This is much simpler if you load mathtools, an add-on package for amsmath: \documentclass{article} \usepackage{mathtools} \newtagform{brackets}{[}{]} \usetagform{brackets} \begin{document} \begin{equation}\label{eq:test} y = 2x \end{equation} See eq~\eqref{eq:test}. \end{document} Result:


3

For adding Eq. use cleveref. For the equation numbers in the margin: \documentclass[leqno]{article} \usepackage{amsmath} \usepackage{etoolbox} \usepackage{lipsum} \makeatletter % detach \eqref processing from \tag processing \let\tagform@ref\tagform@ \let\maketag@@@ref\maketag@@@ \patchcmd{\eqref}{\tagform@}{\tagform@ref}{}{} ...


0

tcolorbox package provides commands to produce colorful framed boxes which can also be applied to math environments. \tcboxmath and \tcbhighmath commands add boxes to math expressions. The second one is used to highlight some part of a math expression, even inside a boxed one. Default configurations for these kind of boxes look like \begin{equation} ...


4

The following example defines \dotarabic, which similar to \arabic prints the arabic form of a counter with the zeros exchanged by \pmzerodot. \theequation is redefined to use \dotarabic instead of \arabic (or \arabic can be redefined, if the zero with dot should be used by all counter outputs). Furthermore \pmzerodot is made robust, because ...


1

This may be help you to find a way \documentclass[twocolumn]{article} % just for grid \usepackage{tikz} \usepackage{eso-pic} \AddToShipoutPicture{% \begin{tikzpicture}[overlay,remember picture] \draw[blue!20!white,thin] (current page.south west) grid [xstep=10mm,ystep=4mm] (current page.north east); \end{tikzpicture}} \makeatletter ...


0

Have you checked out the listings package? It's designed for code samples. There are lots of options, e.g. telling LaTeX what language the code sample is in, so that it can highlight stuff appropriately. By default, the code sample takes up the whole page width. Is that a satisfactory form of centering? \documentclass[a4paper]{article} ...


2

\begin{center}...\end{center} Is the non math centred display environment. (But don't use it with $ to fake a centred math display, the spacing will not be correct).


5

I suggest you do the following: Insert a line-break instruction (\\) and one additional alignment point indicator (&). That way, TeX can tell where to break the lines and on which points to align the rows. With this change in place, one gets: I would like to urge you to consider making a few more changes: Use a \notag instruction at the end of ...


3

Scanning through a book by someone who has thought a lot about mathematical typesetting, namely The Art of Computer Programming, I find nowhere a displayed equation followed by an inlined variable definition. At most, an equation is followed by a condition like "for real x>0". Often Knuth introduces variables before the long equation: "Let θ be ... Then we ...


5

You're not providing any "alignment hooks" in your code; hence, everythings gets pushed against the right-hand edge. The following may be more to your liking -- note the use of the symbol & on all six lines, as well as the three instances of \notag: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{subequations} \begin{align} ...


5

Use \notag for the lines with the labels and alignat \documentclass{article} \usepackage{amsmath} \begin{document} \begin{subequations} \begin{alignat}{2} &\makebox[0pt][l]{Type A:}\notag \\ && A &= 1+1 \label{eq:subeq1}\\ \makebox[0pt][l]{Type B:}\notag \\ && B &= 2+2 \label{eq:subeq2}\\ &\makebox[0pt][l]{Type C:}\notag \\ ...


4

When setting a fraction, I would ditch the power and use \exp. \documentclass{report} \def\LMTD{\mathrm{LMTD}} \def\disch{\mathrm{disch}} \def\ahe{\mathrm{ahe}} \begin{document} \begin{equation} T_e=\frac{T_{\disch}\cdot \exp\big(\frac{T_{\ahe}-T_{\disch}}{\LMTD}\big)-T_{\ahe}}% {\exp\big(\frac{T_{\ahe}-T_{\disch}}{\LMTD}\big)-1} \end{equation} ...


0

Your question is hard to answer to since "it looks really bad" is a very personal matter. However, in case you don't know it or didn't tried, may I suggest the nicefrac package. \documentclass{report} \usepackage{nicefrac} \begin{document} \begin{equation} T_e=\frac{T_{disch}\cdot ...


2

It is not very clear from your post, what you would like to have. Why should T be upright? Does it have a special meaning? In general you should type text as such (\text{}). You should wrap often used terms in new commands. Like this, you are able to change later on, if you do not like your first decision. E.g. I thought that LMTD is some acronym and set ...


4

(You're missing several \\ (double backslash) directives, at the end of each array environment as well as between rows 2 and 3 of the multi-line equation. Once that's fixed, you'll find that split and array environments are entirely compatible with each other.) I suggest you use bmatrix ("matrix with square brackets") environments instead of the "plain" ...


3

I suggest you use the tag macro, which is provided by the amsmath package, to place the dagger symbol. I further suggest you create a dedicated LaTeX macro -- e.g., with the help of the mathtools package -- named \norm. This will make your code more readable. \documentclass{article} \usepackage{mathtools} % loads 'amsmath' package automatically ...


0

This should give the required result: \documentclass{article} \usepackage{amsmath} \begin{document} \[K^{-1}\left\|\sum\limits_{n=1}^N a_ny_n\right\| \leq \left\|\sum\limits_{n=1}^N a_nx_n\right\| \leq K\left\|\sum\limits_{n=1}^N a_ny_n\right\| \eqno{(\dagger)}\] \end{document}


5

The vertical spacing is different, but only noticeable in certain instances. To see this, consider all the possible ways in which you can have text around these displays: \documentclass{article} \usepackage{amsmath} \setlength{\parindent}{0pt}% Just for this example \begin{document} Long/long line before/after display: \begin{minipage}[t]{.5\textwidth} ...


4

As stated in the comments, the only difference is the spacing of the formulas. You should attempt to use equation when possible, and align when you have multi-line formulas. Also: equation throws an error when you have an & inside the environment, so look out for that when converting between the two.


6

Don't use eqnarray. Use align and then mathtools instead of amsmath. Now you have \Aboxed macro. \boxed can't be used across &. \documentclass[a4paper,12pt]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{mathtools} \usepackage[makeroom]{cancel} \usepackage{amssymb} \usepackage{mathrsfs} ...


5

Here are some things I'd do: Equation 1: Replace \max_&Z ~ with \max_Z & (the ~ isn't needed) Equations 2 and 4: replace \mbox{s.t.~} with \text{s.t. } Equation 3: Supply a _ in front of j\in N, to make sure that this string is placed below the summation sign (3 instances) Omit \limits after \sum, since you're already in display math mode ...


5

As noted in comments the amsmath and breqn documentation have several good examples, also the mathtools package has extended versions of several of the amsmath alignments. But the usual style here is to answer inline rather than refer to manuals, so this is a document giving the basic usage of the environments you mention. \documentclass{article} ...


0

Here is the best solution I could found: \pmb{\left[\vphantom{\frac{1}{2}}\right.} \frac{1}{2} \vec{\nabla} \times \vec{v} \pmb{\left.\vphantom{\frac{1}{2}}\right]} It is dirty, but it does exactly what I want:


3

You can do \documentclass{article} \usepackage{bm} \showoutput \begin{document} $[ \vec{\nabla} \times \vec{v} ]$ $\bm{[} \vec{\nabla} \times \vec{v} \bm{]}$ \end{document} It does not work with \left, \right with the default cm fonts as there is no bold extension font (for large brackets) in that font set. However extended brackets are not needed ...


1

You can, as documented in mathtools, thanks to a code by Sébastien Gouezel (§3.6.1 of the doc): \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \usepackage{lmodern} \newcommand\MTkillspecial[1]{% helper macro \bgroup \catcode`\&=9 \let\\\relax% \scantokens{#1}% \egroup } \DeclarePairedDelimiter\brparen \lparen\rparen ...


5

The code you show produces an error message: ! Missing $ inserted. when TeX finds _, because this character is legal only in math mode. The output from then on can not be relied unto. Fix errors as soon as they are raised when processing the file. Your input should be Let the training data \(X\) consist of \(x_{i\dots n}\) observations, where \(n\) is ...


3

I think a better solution would be to use the cuted package from the sttools bundle. It is dedicated to insert some material full-width in a twocolumn environment: \documentclass[journal]{IEEEtran} \usepackage{cite} \usepackage{graphicx} \usepackage{refstyle} \usepackage{amssymb} \usepackage{amsmath} \usepackage{cuted, nccmath} \usepackage{lipsum} ...


2

You want \intertext. \documentclass{article} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{amsmath} \usepackage{manfnt} \begin{document} \noindent I want the comments to align with the main text. \begin{align*} \mathbb E X &= \int x F(dx) \\ \intertext{comments that align with the main text} &= \mu. \end{align*} ...


4

You are already using package amsmath and have therefore \tfrac, which puts the fraction in the math style \textstyle: \documentclass[10pt]{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{geometry} \geometry{a4paper, total={14.5cm, 23cm}} \newcommand*{\diff}{\mathop{}\!d} \begin{document} The amplitude $u_2 (x_2, y_2)$ at the back focal ...


4

First of all, your MWE doesn't work because you wrote \section{equation} ... \end{equation}. Latex does not recognise these tags to be paired, so change the first one to \begin{equation}. Delete the \begin{section} and \end{section} tags, they serve no purpose. If you want to start a chapter in your document (for the article class), then write ...


2

It is better to use the amsmath alignments than eqnarray but either way you get flush left equations by using \documentclass[12pt,fleqn]{article}


1

Here is a solution, patching flalign(*) from mathmath into a leftalign(*) environment, with one optional argument: the equation indent (default \parindent): \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[showframe, noheadfoot, nomarginpar]{geometry} \usepackage{mathtools} \makeatletter ...


3

You may want to use split, along with the tbtags option to amsmath. \documentclass{article} \usepackage[tbtags]{amsmath} \begin{document} \begin{equation} \begin{split} x ={} & 22+2 \\ ={} &5+3\\ &-3+4\\ &+15-0 \end{split} \end{equation} \end{document} If you want two numbers, then use split inside align: the alignment ...


0

Another way to do the same is the following \documentclass{article} \usepackage{amsmath} \begin{document} %------------------------------ %-- Use of \hspace with same set length %------------------------------ x &= 22+2 \nonumber\\ &= 5 + 3 \nonumber\\ & \hspace{5mm} -3 + 4 \nonumber\\ & \hspace{5mm} + 15 - 0 \\ ...


1

I would change the way that you're using aligned: specifically, if there's no equation number on the first line, you should lump in the first line with the rest of the material in the aligned environment, with the [b] option to get the alignment of the equation number with the bottom line, as follows. (Note the usage of ={}& which ensures proper spacing ...


3

With tcolorbox help it's easy to declare your own environments for boxed equations \documentclass[fleqn,12pt]{book} \usepackage{microtype} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{kpfonts} \usepackage{xcolor} \usepackage{amsmath} \usepackage[most]{tcolorbox} \usepackage{lipsum} \tcbset{colback=red!20, colframe=red!80} ...


1

Some alternative examples made with tcboxmath, ams equation|gather|align|... tcolorbox environments: \documentclass[letterpaper]{article} \usepackage{lmodern} \usepackage{amssymb,mathtools} \usepackage[most]{tcolorbox} \tcbset{colback=white,colframe=black} \begin{document} With \texttt{tcboxmath} only the equation is boxed \begin{equation} ...


3

With tcolorbox help it's possible to include equation numbers in framed environments. It provides options ams equation, ams gather, ams align and corresponding starred versions. It's also possible to combine tcolorbox with empheq package. \documentclass{report} \usepackage{amsmath} \usepackage[most]{tcolorbox} \tcbset{colback=yellow!10!white, ...


1

Use the amsmath package and \begin{align} / \end{align} set for a tighter look. \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{amssymb} \newcommand{\ddn}[2]{\frac{\mathrm{d}}{\mathrm{d} #1 } #2 } \newcommand{\ddt}{\frac{\mathrm{d}}{\mathrm{d} t } } \begin{document} \begin{align} ...


1

I would suggest still another variant, also with alignat: \documentclass[a4paper]{article} \usepackage{mathtools} \usepackage{amssymb} \newcommand{\ddn}[2]{\frac{\mathrm{d}}{\mathrm{d} #1 } #2 } \newcommand{\ddt}{\frac{\mathrm{d}}{\mathrm{d} t } } \begin{document} \begin{alignat}{2} x'(t) & = \mathrlap{\ddt\left(\left[-\frac{M}{ω^2}\cos{(ω ...


1

Still another possibility: I would center the final equation rather than align its = symbol with the one on the preceding line. To enhance the visual impact, I would also increase the vertical offset between equations (3) and (4). \documentclass[a4paper]{article} \usepackage{mathtools,amssymb} \newcommand{\ddn}[2]{\frac{\mathrm{d}}{\mathrm{d} #1 } #2 } ...


4

To achieve this alignment, I would use \mathllap and \mathrlap, but I would use these in conjunction with the alignat environment, to ensure the proper alignment of = symbols on each line. Example code: \documentclass[a4paper]{article} \usepackage{mathtools,amsmathm,amssymb} \newcommand{\ddn}[2]{\frac{\mathrm{d}}{\mathrm{d}#1}#2} ...


0

There a a number of online equation editors that can be useful to familiarise yourself with the mathematical syntax of LaTeX. Here are two such editors that provide live updates: http://www.hostmath.com/ http://www.codecogs.com/latex/eqneditor.php


1

A quickly coded option. \documentclass[10pt,letterpaper]{article} \usepackage{mathtools} \begin{document} \[V_o = \left(\frac{ R_1}{( R_1+R_4)}-\frac{R_2}{(R_2+R_3)} \right)V\] \end{document} Now I strongly recommend you go online and begin to read any one of the many fine introductions to LaTeX e.g. http://en.wikibooks.org/wiki/LaTeX Or read this for ...


1

\overbar is wrong initially (I did not found fldauth.cls) This shows the (incomplete) possibilities to use a \overline - like typesetting of a mathematical symbol \documentclass{article} %[times]{fldauth} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{mathabx} \begin{document} %\begin{equation} ...


1

You also can do it with the changcntr package: \documentclass{article} \usepackage{amsmath} \usepackage{chngcntr} \counterwithin{equation}{section} \counterwithin{equation}{subsection} \begin{document} \section{Section 1 Title} \subsection{Subsection 1.1 Title} \begin{equation} a = b \end{equation} \begin{equation} a+2=b+2 \end{equation} ...



Top 50 recent answers are included