New answers tagged

2

Here's a LuaLaTeX-based solution. It doesn't modify the enumerate environment, it doesn't modify the \item macro, and it doesn't require the use of a new macro called, say, \mathitem. Instead, it takes a preprocessor approach: It sets up a Lua function which, by being assigned to the process_input_buffer callback, acts as a preprocessor, scans each line of ...


5

Here's a enumitem way and a patch that starts \( after item and ends \) before \item or at the end of the environment, checking if \ifmmode. Note: \item[...] is not catched here! -- Since the patch is inside the environment group, all other \item definitions in other environments are not changed. It's possible to jump out of math mode with \item $ Non ...


2

You can create a command like \mathitem that you would use in place of \item when you want that the current item contains only math: \newcommand\mathitem[1]{\item $#1$} Your lists will look like this: \begin{itemize} \mathitem{1+1=2} \mathitem{e^{i\pi}+1=0} \end{itemize}


5

There's no need for the \displaystyle directives, no need to surround - and + with {} (empty math atoms), and no need for the \; spacing directives. Instead, use a single align* environment. To maximize the likeness with the template, use \ell instead of l, load a Times Roman font family and (not implemented in the code shown below) use \leq and \geq instead ...


5

Similar to Herr K. but more “semantic” \documentclass{scrartcl} \usepackage{mathtools,array,amssymb} \let\geq\geqslant \let\leq\leqslant \def\maximize#1\subjectto#2\stop{% \begin{array}{r>{\displaystyle}l} \text{max.} & #1 \\ \text{s.t.} & \begin{array}[t]{@{}>{\displaystyle}l@{\qquad}>{\displaystyle}l@{}}#2\end{array} ...


6

Something like this? Note that you don't really need alignat (and you're giving too many equation columns to that environment). \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} \max\quad & \sum_{i=1}^n p_i s_i \\ \text{s.t.\quad} & ...


4

A simple solution is to gobble math with \pdfstringdefDisableCommands: \documentclass{article} \usepackage{hyperref} \makeatletter \pdfstringdefDisableCommands{\let\(\fake@math} \newcommand\fake@math{}% just for safety \def\fake@math#1\){[math]} \makeatother \begin{document} \section{\(I\) cast warnings but I wish I wouldnt} ...


0

\documentclass{article} \usepackage{amsmath} \begin{document} \begin{verbatim} if (some condition) P=P+($W_i*((W-P)/W_i$))\\ end \end{verbatim} \begin{align*} P &= P + W_{i}*((W-P)/W_{i})\\ P &= P + \frac{W_{i}*(W-P)}{W_{i}}\\ \end{align*} \end{document}


2

I think you could show fewer equations if you used words to explain the necessary steps. The steps as far as the first integration could be presented as follows. \documentclass[12pt,twoside]{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} We start from the fact that \begin{equation*} \frac{ \displaystyle g(v)}{\displaystyle ...


0

I propose to use array for the first series, and align* for the second. I change the size of the delimiters: most of them were too large, at least for my taste: \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[showframe]{geometry} \usepackage{mathtools, cancel, array, amssymb} \begin{document} \[\renewcommand\arraystretch{1.5} ...


0

Here is a slight variation on John Kormylo's solution using the AMS align* environment. The align* environment organises alignment in "pairs" so I have separated the \Longrightarrow from the equations with a && and then there is a second alignment around the equals signs. For the first set of equations this produces (the second set I imagine is much ...


0

I'm not sure if this looks any better, but here is a version using align*. \documentclass[12pt,twoside]{article} \usepackage{amsmath} \usepackage[makeroom]{cancel} \usepackage{amssymb} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{graphicx} \usepackage{soul} \usepackage{calc} \usepackage{showframe} ...


1

Use \span to merge cells. You need one \span per & you want to ignore. For example, your sample output could be produced like this: \begin{align*} \text{really really really long equation} \span \span &= a \\ a &= b & b &= c \\ c &= d & d &= e \end{align*}


1

A variation on \bigmaltese: \documentclass{article} \usepackage{graphicx} \usepackage{amsmath} \makeatletter \newcommand{\bigGreek}[1]{% \mathop{% we want it to be an operator \mathchoice{\big@Greek\displaystyle\Large{#1}} {\big@Greek\textstyle\large{#1}} {\big@Greek\scriptstyle\normalsize{#1}} ...


4

Using my answer at How are big operators defined?, I merely substituted \Lambda instead of \maltese. While the symbols are slightly different vertical heights, one notes the limits are aligned for both the sigma and lambda. \documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \DeclareMathOperator*{\foo}{\scalerel*{\Lambda}{\sum}} ...


1

It depends on the meaning of what you want to write. This is a matter of pure semantics. You have two options: If the « hat » means « matrix M », then the hat is not part of the name of the matrix. It just says that M is a matrix. In this case, you should use \hat{\mathbf{M}}. However, if you call the matrix « M̂ », that is, the « hat » is actually a part ...


1

A simple code with flalign* and the dcases* environment from mathtools: \documentclass{article} \usepackage{mathtools} \usepackage[showframe]{geometry} \begin{document} \begin{flalign*} & y_{pij}^{mk}=\begin{dcases*} 1, & \parbox[t]{0.863\linewidth}{ If the robot loads or uloades a part to/from machine $m$ in position $p$ and gripper one holds ...


1

For example: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation*} \left\{% \begin{array}{ll} 1 & \text{\parbox[t][][t]{0.8\textwidth}{If the robot loads or uploads a part to/from machine $m$ in position $p$ and gripper one holds a part that should be loaded on machine $i\in \mathcal{M}$ and gripper ...


6

There are several things that you should do: Use a display-style math environment, like \[ ... \]. Use the cases environment to typeset mathematical cases. Use a \parbox to allow your text to be typeset on several lines. This said, you can do this: \[y_{pij}^{mk} = \begin{cases} 1, & \parbox{5cm}{If the robot loads or uloades a part to/from machine ...


18

From the Manual ! • It is only possible to typeset text in math mode under considerable restrictions. Math mode is entered and exited using any character of category code 3 (e.g., in plain TEX this is $). Math subscripts and superscripts need to be contained within braces (e.g., {^y_i}) as do commands like \times or \cdot. However, even modestly ...


0

If you want to display material in sub- and superscripts using roman/upright rather than italic letters, you should render the main material (i.e., what's on the main math axis) using roman/upright letters as well. One way to render all math material with upright letters on a document-wide basis is to load the mathastext package: \usepackage{mathastext} ...


0

You may also want to try \begin{Bmatrix}\end{Bmatrix}, for example \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} \begin{Bmatrix} c & u & r & l & y \\ b & r & a & c & e \\ i & s & \\ & c & o & o & l \end{Bmatrix} \end{equation} ...


1

Both the answers that have already been given have an obvious refinement, that is, make the symbols scalable with the math style. Even @egreg’s answer, which is more flexible than @LoopSpaces’s, is defective in this, in that it statically refers to the “text size” (it uses \textfont2). These enhancements are just routine, but since 24 hours have already ...


6

You should define macros for the pictures; here's a possibility. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{shapes,snakes} \newcommand{\KP}[1]{% \begin{tikzpicture}[baseline=-\dimexpr\fontdimen22\textfont2\relax] #1 \end{tikzpicture}% } \newcommand{\KPA}{% ...


2

Here's how I did it: \documentclass{article} \usepackage{amssymb} \usepackage[svgnames]{xcolor} \usepackage{tikz} \usetikzlibrary{knots} \tikzset{knot/.style={double=#1,double distance=1pt,line width=2pt,white}} \begin{document} \begin{enumerate} \item \(\langle \tikz[baseline=-.8ex] \draw[knot,double=Red] (0,0) circle (1ex); \rangle = 1\) \item \(\langle ...


2

tabular starts text mode, thus math mode needs to be set for the cells to get \frac work: \begin{tabular}{cc} $\frac{1}{2}$ & $\frac{3}{4}$\\ \end{tabular} If it is used inside math mode, environment array can be used, which automatically switches the cells to math mode, see Mico's answer. Another approach is offered by package siunitx, where ...


1

You should probably be using an array environment, in math mode. \documentclass{article} \begin{document} $\begin{array}{ccc} \frac{1}{2} & \frac{3}{4} & x/y(z) \end{array}$ \end{document}


9

The following example uses specialized packages for the different tasks: mhchem for easier input and typesetting of chemical formulas. siunitx for setting units, numbers and numbers with units. There are many configuration options. amsmath for more advanced features in the area of mathematical typesetting. Example: \documentclass{article} ...


1

You need to escape the math mode with \text{} to use fontawesome macros. \documentclass{article} \usepackage{fontawesome} \usepackage{amsmath} \begin{document} \faTwitter \begin{align*} \text{\faTwitter} &= E \cdot e^{-r(T-t)} \cdot \Phi'\left[d(S,t) - \sigma \sqrt{T-t}\right] \cdot \underbrace{\frac{\partial}{\partial \sigma} ...


3

what you probably want is $v \in V$. the \in must be in math mode (the part inside $...$ as you have already used correctly for $G = (V, E)$). since \in is recognized as math, tex will switch into math mode if it isn't already there, and will therefore report a missing $ when it encounters something that can't be math. this is an elementary principle of ...


2

(too long for a comment, hence posted as an answer) Some comments and observations: Not even one of the packages loaded in your preamble is needed to compile the body of the document. Do take some time to figure which packages are really needed to compile your full document. The body of the document you've posted actually compiles without errors. You may ...


3

The _ is only valid in math mode, it doesn't work outside of it. \textbf{...} - as the name rather suggests - is a text mode command. Using \textbf{...} - whether within math mode or outside of it - puts you in text mode. The argument of \textbf{...} is typeset in text mode. As such, you cannot use _ within \textbf{...}. Try $\mathbf{a_{1}}$


1

$\textbf{...}$ isn't allowed since \textbf is meant for text mode only. There are multiple ways to achieve bold math, depending on the desired output. \mathbf will print bold in math, but the letters are upright whereas \boldmath and \bm produces italic letters. There is \boldsymbol (also amsmath) also for symbols that are not printed in bold by ...


1

Is perhaps this that you want? \documentclass[12pt]{report} \usepackage[ruled,linesnumbered]{algorithm2e} \usepackage{amsmath} \begin{document} \begin{algorithm} \DontPrintSemicolon \caption{BE radix-8 IMML Modular Multiplication}\label{alg1} \KwIn{ $x=\sum_{i=0}^{n-1} x_i\cdot2^i$, $y=\sum_{i=0}^{n-1} y_i\cdot2^i$, $p=\sum_{i=0}^{n-1}p_i\cdot2^i$ ...


5

I think you have asked several questions. The first is about $x, y$ versus $x$, $y$. I think the second one is semantically and hence typographically right since the comma is not part of the mathematical expression. Your second example is a little ambiguous. There I would include the comma in the mathematics. An implicit question is the choice between ...


4

First things first: An algorithm most probabilly will never cover all use cases at once. A good rule of thumb is to assume that on average a LaTeX document will reach 90% of the final quality without any direct intervention. That said, inserting a \linebreak here and there should not be the end of the world, i.e. \begin{defn} The double integral of $f$ on ...


2

breqn will break at all non hidden relation symbols. \documentclass{article} \usepackage{breqn} \DeclareFlexSymbol{\mywedge}{Rel}{bin}{5E} \DeclareFlexSymbol{\myvee}{Rel}{bin}{5F} \begin{document} \begin{dmath}[number={$S_{1,19}$}] p_{19,a} \hiderel{<} p_{1,a} \myvee p_{19,a} + p_{19,b} \hiderel{<} p_{1,a} + p_{1,b} \myvee p_{19,a} \hiderel{=} ...


5

It is instructive to examine the exact definitions of \( and \) that are provided by the LaTeX kernel (contained in the file latex.ltx, version early 2016): \DeclareRobustCommand\({% \relax\ifmmode\@badmath\else$\fi}% \DeclareRobustCommand\){% \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi}% The main thing to note is that \( and \) act as ...


-1

\documentclass{article} \usepackage{amsmath} \usepackage{amsthm} \usepackage{mdframed} \theoremstyle{definition} \newtheorem{defn}{Definition} \surroundwithmdframed[leftmargin=-10pt,rightmargin=20pt]{defn} \begin{document} \begin{defn} The double integral of $f$ on $R$, denoted as $\iint_R f(x,y) \, \operatorname{d}\!A$ \end{defn} \end{document} Same code ...


1

It depends exactly what you mean by "computer zero." I'd guess you mean a slashed zero in a monospaced font; you can obtain this by choosing a font that has a slashed zero in its \texttt series and writing $\texttt 0$; for example, Anonymous Pro will work by adding this to your preamble: \usepackage[T1]{fontenc} \usepackage[ttdefault=true]{AnonymousPro} ...


2

The argument to \cramped is typeset as a subformula, so spaces inside it are frozen; it's the same that happens with \left and \right. Thus the spaces around the minus sign in \cramped{1-2} are not flexible any more and the result is guaranteed to look wrong. For the same reason, \left and \right should never be used in inline math. Of course you get rigid ...


0

Solved it using: % Font fourier \usepackage{fourier} % Only use the math font of mathpazo \let\temp\rmdefault \usepackage{mathpazo} \let\rmdefault\temp


2

It's a little bit hacky and overrides all the nice measuring mechanisms from amsmath, but it should be prety relialble in most of the cases. Note that the solution is sensible to the leqno and reqno options. \documentclass[leqno]{amsart} \makeatletter \newenvironment{tagedequation}[1]{% \gdef\@tempa{#1} \refstepcounter{equation} ...


1

This might be a start. I've shown two varieties depending on your desires for centering the content. \documentclass{amsart} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{flalign} \phantom{(r\in\mathfrak{N})}&&\theta' = \gamma\theta, \quad r'=r&&(r\in\mathfrak{N}) \end{flalign} \begin{flalign} &&\theta' = \gamma\theta, ...


5

One approach is to right-align both matrices, using \begin{bmatrix*}[r]…\end{bmatrix*} (from the mathtools package) instead of bmatrix. Then, adding \phantom{-}0 to entries in the second and third columns of the first matrix will add the correct amount of space. \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align} % ...


4

You probably want to set Preferences > Look & Feel > Display > Instant Preview to No math.


0

I find that { } (\{\} in LateX) is perfectly clear to mathematicians, maybe not to computer scientists. I would use the following: This is obtained with \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm}[H] \begin{algorithmic}[1] \State $myset \gets \{\}$ \For{$i = 0\, \textbf{to}\, 4$} ...


2

You can use \substack from the mathtools package, as that command is designed exactly to stack multiple subscripts. If you want more spacing between the two lines, you can add e.g. \\[0.3ex] (or any other amount) instead of \\ in the argument to the \substack command. \documentclass[preview,border=2mm]{standalone} % Only to get minimal output ...


2

You can try this, with align and aligned: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align*} & R_\mathrm{in}=R_{B}\parallel [r_{\pi}+(\beta+1)R_{E}]\\ &R_\mathrm{out}=R_{C}\\ &A{u} \!\begin{aligned}[t] & =V_\mathrm{out}/V_\mathrm{in}\\ % & =[-g_{m}(R_{C}\parallel R_{L})]/[1+(g_{m}+1/r_{\pi})R_{E}] ...


2

Package mathtools, which upgrade amsmathdefine for such purposes math environment multlined. by it you can obtain: \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align*} & R_{in}=R_{B}\parallel [r_{\pi}+(\beta+1)R_{E}]\\ & R_{out}=R_{C}\\ & A{u}=V_{out}/V_{in}\\ &\begin{multlined}[t] =[-g_{m}(R_{C}\parallel ...



Top 50 recent answers are included