New answers tagged

8

You wrote, I've managed to get this using the tabular environment, but it's obviously not the right way to do this. You were actually quite close! The main change I'd recommend you make is switching from a tabular environment to an array environment. The following screenshot shows the effect of this change. The third "take" involves applying further ...


0

The question asks how to write equations, so this is not an answer in that sense. Here, I suggest a method on how to draw them. Since + is an operation of coalescence, in general, and = indicates identity (such that C is A and B combined together), and since everything algebraic can be represented visually, the TikZ solution is presented by: MWE \...


8

The systeme package allows you to do this. The command \sysdelim.. is used here to remove the braces that are placed by default. \documentclass{article} \usepackage{systeme} \begin{document} \sysdelim..\systeme{4x+7=7x+2,7=3x+2,5=3x,\frac{5}{3}=x } \end{document}


3

You can use TABstacks. Shown here in 3 ways, depending on the desired equation-number vertical alignment. \documentclass{article} \usepackage{tabstackengine} \stackMath \setstackgap{L}{14pt} \begin{document} \begin{equation} \alignCenterstack{ a+b+c+d+e+&f+g+h \\ =& j + k + l + m +n\\ =& j' + k' + l'+ m' +n'} \end{equation} \begin{...


3

Here are three possibilities. In the first, you alignthe = signs with another symbol of the first line, The second uses the optional argument of the \MoveEqLeft command from mathtools, and the third nests the aligned environment in a gathered environment (to fine-tune the placement of w= w.r.t. the first line, you can add to the latter some \hspace). ...


6

I propose this solution, using mathtools, makebox and makecell, with some manual adjustment: \documentclass{article} \usepackage{mathtools, nccmath} \usepackage{makebox, array, makecell} \begin{document} \bgroup \setcellgapes{2pt}\makegapedcells \begin{align*} \int x\exp(ax)\, dx\, & = \frac{x}{a}\exp(ax)-\frac{1}{a}\int\exp(ax)\, dx\\ & \...


2

The fact that the steepness of the surds increases with the overall size of the square-root symbols is not a flaw in the design of the math font. Instead, it embodies a long-standing typographic tradition that has held up pretty well over the decades (and probably even centuries). If you can't stand the "vertical look" of the taller surds, do contemplate ...


3

With the help of cases and aligned: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation}\nonumber A = \begin{cases} A_{1} & m=1, n=1 \\ A_{2} & 2 \leq m \leq M, n=1 \\ A_{3} & m=1, 2 \leq n \leq N \\ A_{4} & \begin{aligned} &2 \leq m \leq M, \\ &2 \leq n \leq N \end{aligned} \...


0

Just change the definition of \theequation when the supplementary material starts. \documentclass{article} \usepackage{mathtools} \numberwithin{equation}{section} \begin{document} \section{Main material} We have an equation \begin{equation}\label{main} 0=0 \end{equation} that will be used in~\eqref{suppl}. \section{Supplementary material} \renewcommand{...


0

A simple solution with \newtagform and \usetagform, from mathtools. However note tha cross referencing will have to be done by hand: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \newtagform{supplementary}[S.]() \counterwithin*{equation}{section} \begin{document} \begin{equation} \label{eq} \bar\gamma_M:=\frac{1}{\alpha+\...


3

While LaTeX and MathJax use similar syntax, their underlying engines are very different. Whereas it's possible to force a line break using the approach shown in your posting, that approach is not syntactically valid in a LaTeX document. If all you need to achieve is show two displayed equations, one below the other, in a LaTeX document, I suggest you (a) ...


0

This error was created by lineno package in the style file. I had to simply go in style file and un-comment \RequirePackage{lineno} and it was fixed. Note: While not a general fix but if you are working on a NeurIPS Submission, this could be one of the reasons for this error This is what I did finally (didn't need the line numbers - check Output PDF on ...


2

You can put the combined contents in a tcolorbox and draw the strikeout on top using the finish key. This answer is based on the answer to Strike a paragraph of text by Ulrike Fischer. I added the pattern fill, a custom pattern with wider lines, and a new tcolorbox environment to make it easier to use the box multiple times. Note that it is not possible to ...


2

The commands only work in displaymath mode. Try: $$ E = m c^2 \eqno (1) $$ $$ E = m c^2 \leqno (2) $$ Your examples cannot work as the definion of \endequation already uses \eqno: % from latex.ltx \def\equation{$$\refstepcounter{equation}} \def\endequation{\eqno \hbox{\@eqnnum}$$\@ignoretrue} So you can define your own environment (full MWE): \...


2

\leqno is a primitive and not used in latex. The option in latex redefines \@eqnnum: \documentclass{article} \makeatletter \newcommand\useleqno{\renewcommand\@eqnnum{\hb@xt@.01\p@{}% \rlap{\normalfont\normalcolor \hskip -\displaywidth(\theequation)}}} \begin{document} \begin{equation} a + b = c % ...


4

What about the following. The equation numbers were achieved using \leqnomode from here (Red lines indicate text width: \documentclass{article} \usepackage{mathtools} \usepackage{amsmath} \makeatletter \newcommand{\leqnomode}{\tagsleft@true} \newcommand{\reqnomode}{\tagsleft@false} \makeatother \begin{document} \leqnomode \renewcommand\theequation{\alph{...


2

You could use a top-aligned aligned (pun intended) environment: Observe that aligned, unlike flalign*, does not initiate and terminate math mode by itself; instead,aligned must be embedded in a math-mode group (here: the group that begins and ends with $ symbols). \documentclass{article} \usepackage{amsmath} \begin{document} \begin{itemize} \item[(a)] ...


6

A solution with alignat, and some improvements (in particular, fractional coefficients in medium size look better, in my opinion): \documentclass[11pt]{book} \usepackage{mathtools, amssymb, nccmath} \begin{document} \begin{alignat*}{2} & \mathcal{L}_{a2c} & &= \mathbb{E}_{s_t,a_t\sim\pi_{\theta}}\Bigl[\mathcal{L}_{a2c_\text{policy}} + \mfrac{...


3

One option is to place each of the left-hand sides of te equations in equally-sized boxes, and <align> each element to the left. \eqmathbox[LHS][l]{<lhs>}, as defined below, will help with that: \documentclass{article} \usepackage{eqparbox,xparse,amsmath,amsfonts} % https://tex.stackexchange.com/a/34412/5764 \makeatletter % \eqmathbox[<tag&...


3

You need to capture the widths of the widest elements in each of your equations. Then you can use those widths to impose alignment between elements that aren't as wide. Below I use a slight modification to eqparbox via \eqmathbox[<tag>][<align>]{<math>} which stores the maximum width of each <tag>ged box with varying <math> ...


2

I propose this other solution, with the Bmatrix environment `mathtools and various small improvements: \documentclass[]{article} \usepackage{amsmath,mathtools, nccmath} \usepackage{siunitx} \begin{document} \section{Equations} \begin{fleqn}\sisetup{exponent-product =\,} \begin{equation} \begin{aligned} & PMV =0.303\,e^{-0.036M}+0.028 \times{}\\ &...


2

I suggest split: \documentclass[11pt]{report} \usepackage{amsmath} \begin{document} \begin{equation}\label{eq:eqr} \begin{split} \text{from}\quad r_i\geq20;\quad i= p+q \quad\text{where}\quad p &= \operatorname{count}[r_{j(i)}=0]\\ q &= \operatorname{count}[r_{j(i)}>10] \end{split} \end{equation} \end{document} You could also vertically ...


1

I squeezed the operator spacing slightly in the bracketed term I think this does what you ask, although the layout seems a bit confusing to me, if I understand its meaning correctly it would be clearer not to use the large brackets and let the terms wrap over several lines at the outer level. \documentclass[]{article} \usepackage{amsmath} \begin{document} ...


3

You can use the mini! environment, from the dedicated package optidef, which defines several possible layouts. By default, the objective function part is the first subequation, but you can easily have the parent equation number using \tag{some number}: \documentclass[conference]{IEEEtran} \usepackage{amsmath} \usepackage[short]{optidef} \begin{document} \...


3

Like this? \documentclass[conference]{IEEEtran} \usepackage{amsmath} \begin{document} \begin{subequations}\label{MCRequation:main} \begin{align} & \text{min} && F(x) = \sum_{d \in D_{}}^{} \sum_{p \in P_d}^{} \xi _{dp} x_{dp} & & \tag{\ref{MCRequation:main}} \\ & \text{s.t.} && \sum_{p \in P_d}^{}x_{dp} = h_d, ...


4

Use \AtBeginEnvironment from etoolbox. \documentclass{article} \usepackage{amsmath} \usepackage{etoolbox} \newcounter{mycounter} \AtBeginEnvironment{equation}{\setcounter{mycounter}{0}} \AtBeginEnvironment{equation*}{\setcounter{mycounter}{0}} \AtBeginEnvironment{align}{\setcounter{mycounter}{0}} \AtBeginEnvironment{align*}{\setcounter{mycounter}{0}} \...


5

The second column in cases is typeset in math mode and is typically a short condition; when text is involved, \text can be used, but this doesn't split copy across lines. You can do it with a \parbox. On the other hand, the result is not pretty. I suggest using a shorthand that can be explained just below the equation. \documentclass[a4paper, 10pt, ...


3

As you've (re)discovered, the cases environment doesn't automatically line-wrap long explanations. As a remedy, I suggest you encase the contents of the cases environment in a custom array environment which allows line-wrapping. Note that it's not necessary to employ \text directives for the explanatory textual material. [For some reason, I can't upload a ...


1

Thank you very much to @David Carlisle and @Marijn that with your comments I have had another possibility: \documentclass{book} \usepackage[top=2.5cm,bottom=2.2cm, left=3.2cm,right=1.5cm,headsep=10pt, a4paper]{geometry} \usepackage{mathtools,amssymb} \usepackage[svgnames, dvipsnames, table, x11names]{xcolor} \usepackage{pifont} \...


1

I wouldn't really expect these to be aligned as they have different sizes, however you can get a bit closer if you use m rather than p columns. I use tabular here as tabularx isn't really helping as you know in advance given XX that there will be two equal columns, so you may as well specify that directly. \documentclass{book} \usepackage[top=2.5cm,bottom=2....


2

You have two solutions to use every now and then \abovedisplayshortskip in the place of \abovedisplayskip: the \useshortskip command from nccmath just before entering the amsmath environment, or \SwapAboveDisplaySkip from mathtools after entering the environment. Note however that if the line above is too long, the result can be ugly. Demo: \...


7

The reason the three equations are centered horizontally in your code is because you're using a matrix environment, which is programmed to center the contents of each entry, using inline math mode. Switching to a cases environment takes care of left-aligning the cell contents. However, the equations continue to be typeset in inline math mode and the ...


6

You can use the cases environment from amsmath. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} \begin{cases} u_{t}=\nabla\cdot D(u_{t})\nabla u_{t}+\mu_{1} \frac{c_1}{k_1+c_1}u_1+\mu_{2}\frac{c_2}{k_2+k_{12}c_1+c_2}u_1\\ c_{1,t}=\Delta c_1-\frac{\mu_{1}}{y_1}u_{1\infty} \frac{c_1}{k_1+c_1}u_{1}\\ c_{2,t}...


0

With use of the numcases environment from the cases package: \documentclass{article} \usepackage{amsmath} \usepackage{cases} \begin{document} \begin{numcases}{a=} b(x) & for $t<t_1$ \label{eq:subeq1},\\ c(x) & for $t\geq t_1$ \label{eq:subeq2} \end{numcases} From \eqref{eq:subeq1} folows \dots \end{document}


0

You can have this, based on empheq(which loads mathtools) but you'll lose the possibility to refer to the definition as a whole: \documentclass{article} \usepackage{empheq} } \begin{document} \begin{empheq}[left={a=\empheqlbrace}]{alignat=2} b(x) \quad &\text{for } t<t_1 \label{eq:subeq1} \\ c(x) \quad &\text{for } t\geq t_1 \label{eq:subeq2} \...


2

Here is a proposition with alignat and 3 columns: \documentclass{article} \usepackage{amsmath} \begin{document} \begin{alignat}{3} & & & a =A \\ b&=B &\hspace{3.5em}& & \hspace{3.5em}c&=C \\ d&=D & & & e&=E \end{alignat} \end{document}


6

If it is ok to have a shared number for the two column part you can use \documentclass[a4paper]{article} \usepackage{amsmath,amssymb} \begin{document} \begin{gather} a=A \\ \begin{aligned} b&=B & c&=C \\ d&=D & e&=E \end{aligned} \end{gather} \end{document} Note also this is the preferred method for giving ...


1

Here two possibilities: one with the aligned environment, nested in equation, ans using\MoveEqLeftfrommathtools, the other usesflalignand an *adhoc* alignment point. Both use the medium-size fractions (\mfrac) fromnccmath`for the numerical fractions, as I think it looks better: \documentclass{article} \usepackage{nccmath} \usepackage{mathtools} \begin{...


1

Displayed equation(s) always consider text width, meanwhile \begin{center} ... \end{center} width of environment, where it is. Similar feature for displayed equation you can obtain with enclosing it in minipage with width of environment, where it is. This is done with using \linewidth for width of minipage. Edit: Use of minipage for equation may lead to ...


1

You can redefine the equation environment so that it would automatically adjust to the current \linewidth (thanks to @Zarko's comment) using the etoolbox package. \documentclass[12pt]{amsart} \usepackage{geometry, amsthm} \geometry{letterpaper, margin=1in} \usepackage{etoolbox} \BeforeBeginEnvironment{equation*}{\begin{minipage}{\linewidth}} \...


4

You can get the desired centering by using array; however, this doesn't seem the best way to lay out the equation. For the second equation, I'm not seeing why using l instead of {u,v}: \documentclass[journal]{IEEEtran} %\usepackage{cite} % is it compatible with IEEEtran? \usepackage{graphicx} % no pdftex option %\usepackage{epstopdf} % not required \...


2

I would write your equation as follows: \documentclass[jornal]{IEEEtran} \usepackage{amssymb, amsthm, bm, mathtools} % math env. \DeclarePairedDelimiter\abs{\lvert}{\rvert} \usepackage{cases} \interdisplaylinepenalty=50 \usepackage{color} \usepackage{enumerate} \usepackage{subfig} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{equation} \sigma^\...


4

Are you looking to achieve the following result? I must confess to having no idea what "note2" is supposed to represent in the structure of the equation. If you inspect the code below, you will notice that I replaced the \left\{ and \right. instructions and the aligned environment with a single cases environment. \documentclass{article} \usepackage{...


10

\text is when the subscript is textual. You should also prefer \textcolor and brace the whole \underbrace construct. \documentclass{article} \usepackage{amsmath} \usepackage{xcolor} \begin{document} \begin{equation} {% make the \underbrace an ordinary atom \underbrace{\textcolor{red}{I_j (x)} \ast \Delta_j(x,t_l,\textcolor{red}{p})}% _{I_j(x)(x-...


6

I see essentially two sources of trouble: LaTeX allows “Display math mode”, which is the math mode implied by the \[...\] syntax, only inside the so-called “paragraph mode” (the name was chosen by Leslie Lamport himself), which is, roughly speaking, the mode LaTeX is in when it is typesetting ordinary paragraphs. Unfortunately, the main argument of a \...


1

Since you not provide MWE (Minimal Working Example, a small complete document which we can test as it is), we haven't any information about your document layout, used packages relevant to your equation and about eventual defined new commands or math operators. Also is not clear, why you require that part of equation use \tt fonts (btw, correct is \ttfamily) ...


0

Your MWE having some errors, e.g., \k, \kt, etc. I just removed just \ for compiling purpose, and the modified codes are given below: \documentclass{book} \usepackage{mathtools} \begin{document} \begin{align}\nonumber (A_{1}^{5}+A_{8}^2)\tt_{m}^{2}k^{2}P_{m}^{5}&-\left(2(A_{1}^{2}+A_{2}^2) (\Delta_{a}-\omega_{m}\chi^{2}C)\omega_{m}\chi^{2}-2J^{2}\...


0

Several other options to include a line break in your equation are described in https://stackoverflow.com/questions/2860145/how-can-i-have-linebreaks-in-my-long-latex-equations


2

\documentclass[12pt]{article} \usepackage{mathtools} \usepackage{amssymb} \usepackage[showframe, a4paper, total={6.25in, 9in}]{geometry} \begin{document} \begin{align*} L\left(\Gamma_{(k,2k)};x\right) & = \Psi(L(G_1))\Psi(L(G_2))-\Psi(L(G_1))\Psi(L_4(G_2))-\Psi(L(G_2))\Psi(L_3(G_1)) \\ & = x(x-1)^{(6k-2)} \times\bigl(x^3-(3k+5)x^...


4

I propose a solution based on \DeclarePairedDelimiterXPP from mathtools: \documentclass[]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{mathtools} \DeclarePairedDelimiterXPP{\PR}[1]{\operatorname{Pr}}{[} {]}{}{\begin{array}{@{}l@{}}#1 \end{array}} \begin{document} \[ \PR*{ (\mathsf{pp}, \mathcal{T}) \xleftarrow{\$} \textsf{...


Top 50 recent answers are included