New answers tagged

3

Opinion based answer: For variables that have human readable names or are acronyms (somehow), I would prefer \text or a \DeclareMathOperator approach (or \mathit and \mathrm, depending on personal taste) If the symbols are used more than once, markup macros are a better way \documentclass{article} \usepackage{mathtools} \DeclareMathOperator{\pdf}{pdf} \...


6

First, be sure to load the amsmath package, as it provides for better positioning of stacked math accents. Second, write $\dot{\hat{E}}$ A full MWE (minimum working example): \documentclass{article} \usepackage{amsmath} \begin{document} $\dot{\hat{E}}$ \end{document} Just for comparison, here's the output of \dot{\hat{E}} if the amsmath package is ...


0

How to create a custom .cwl-file for TXS: Open any ASCII-Text editor of your choice, e.g. vi, Notepad++. Alternatively: use TXS. Create and save a new text file with the file extension .cwl. If created for a package, the .cwl-file needs to be named in compliance to the package name. Add all commands you created as follows: #<author> <date> \&...


7

This can be done using the \overset command, which takes two arguments. The first argument would be the symbol or character that you want to place on top, while the second would be the main character. \overset{\triangle}{ABC} would produce the result you are after, with a triangle centered above ABC This requires amsmath-package. I tend to load mathtools, ...


3

Do get rid of all \mathop directives (it's not correct to treat \Sigma and \beta as "math operators" -- they're just "ordinary" symbols) and all \limits directives (you definitely want to set the subscripts to the side of the main symbol, not immediately below them), and do use \hat and \widehat directives instead of \wedge to place "hat" symbols on top of \...


0

I once needed some special integral signs and sort of 'faked' them using TikZ. You could do the same thing for your arrow. Here is an example: \def\mylongmapsto#1{% \begin{tikzpicture} \draw (0,0.5mm) -- (0,-0.5mm); \newlength\mylength \setlength{\mylength}{\widthof{#1}} \draw[->] (0,0) -- (1.2\mylength,0) node[above,midway] {#1}; \end{tikzpicture} } \...


4

It is not a library what is causing you trouble. If you include \left( also a \right) (or a \right., or maybe mathematically senseless, but also \right], \right|, etc. would work) should be included in the same equation line, and vice versa. If you jump a line in, say, align-environment you would get an error. \begin{align} X&=\left( \sum \mbox{...


5

Loading amsmath naturally switches \frac to \tfrac when in "inline math" (or text style) and \dfrac under "display math" (or display style). This provides a better layout: \documentclass{article} \usepackage{amsmath} \begin{document} See $\frac{1}{2}$, or \[ \frac{1}{2} \quad e^{\frac{1}{2}}. \] \end{document} However, you can update \frac to ...


0

\documentclass{article} \usepackage{amsmath} \begin{document} \[ \hat{y}_i= \begin{cases} y_i, & \text{if}\ i\notin I\\ (x\hat{\beta})_i, & \text{if}\ i \in I \end{cases} \] \end{document}


5

Here's a solution that uses the dcases environment provided by the mathtools package. It works like cases, except that all contents are rendered in \displaystyle automatically. The screenshot also shows the output of the corresponding cases environment. \documentclass[12pt,a4paper]{article} \usepackage{mathtools} \begin{document} Consider the following: \[...


5

Here's a solution that aligns three columns, adapted from this answer. \documentclass{article} \usepackage{amsmath} \begin{document} Consider the following: \[ P\Big[\frac{1}{2}+\mu \Big] = \setlength{\arraycolsep}{0pt} \renewcommand{\arraystretch}{2} \left\{ \begin{array}{l @{\quad} l r l} 0 & \text{if } & \mu &{}< -\dfrac{1}{...


8

I'd forego the use of \displaystyle, setting the entire construction using amsmath's cases: \documentclass{article} \usepackage{amsmath} \begin{document} Consider the following: \[ P\bigl[ \tfrac{1}{2} +\mu \bigr] = \begin{cases} 0 & \text{if }\mu <-\tfrac{1}{2} \\ \tfrac{1}{2} + \mu & \text{if }-\tfrac{1}{2} \leq \...


2

You can't use _ in the argument to \text. You should better use \mathrm and \xrightarrow: \documentclass{article} \usepackage{amsmath} \usepackage{siunitx} \begin{document} \begin{equation} 2I_{x}S_{z} \xrightarrow{\ang{90}\ \mathrm{Pulse}_{I_y}} \end{equation} \end{document}


10

(This is an edited version of an answer I posted on Math Stack Exchange. The original question was about doing math without handwriting due to disability. link.) (Context: I have a chronic pain condition and typing is very painful.) I use a system based on NatLaTeX to dictate all of my formal mathematics, including anything in that I'm going to turn in ...


2

Really it is the same question: \documentclass[preprint,showpacs,preprintnumbers,amsmath,amssymb]{revtex4} \usepackage{amsmath} \newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}} \begin{document} \begin{center} $\let\left\relax\let\right\relax \def\frac#1#2{((#1)/(#2))} \frac{2 (\alpha +3) (2 \alpha +5) (10 \alpha +17) (10 \alpha +19) (...


3

\documentclass[preprint,showpacs,preprintnumbers,amsmath,amssymb]{revtex4} \usepackage{amsmath} \newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}} \begin{document} $\let\left\relax\let\right\relax \frac{1}{250} \left(50 (2 k+7)+\sqrt{50-10 \sqrt{5}} \left(-3 \sin \left(\frac{2}{5} \pi (1-2 k)\right)+2 \sin \left(\frac{4 \pi k}{5}\...


3

To locate the error look in the log for a ( without a matching ) before the error, In this case (./Thesis.bbl So the error is on line 238 of the generated bibliography So, delete Thesis.bbl, fix the corresponding entry in the bib file and re-run latex and bibtex to re-generate.


4

While there probably is a pure LaTeX solution, one can try with tikz : \documentclass{standalone} \usepackage{tikz} \begin{document} $\left(\tikz[scale=.9, baseline={(0,-.1)}]{\draw(-1,0)--(1,0) (0,-1)--(0,1) (-.4,0) -- +(0,-1) (0,.4) -- +(1,0);\node at (-.5,.5) {T}; \node at (.5,-.5) {B}; \node at (-.2,-.5) {$a$}; \node at (.5,.2) {$a^t$};}\right)$ \end{...


3

If the vertical bar should a kind of math accent, you can use the following idea: \documentclass{article} \usepackage{amsmath} \makeatletter \DeclareRobustCommand{\vbar}[1]{{\vbar@accent{#1}}} \newcommand\vbar@accent[1]{% \overset{% \text{\smash[b]{\rule[-0.4ex]{0.4pt}{0.8ex}}}% <-- customize 0.8ex }{#1}% } \makeatother \begin{document} $X+\...


4

Try with $\stackrel{|}{\tau} $ base $\stackrel{\tikz{\draw[black] (0,1) -- (0,0) ;}}{\tau} $ the second option with TikZ.


2

The explanation for the dual naming is in the following lines of plain.tex 837 \mathchardef\wedge="225E \let\land=\wedge 838 \mathchardef\vee="225F \let\lor=\vee So \land is just an alias for \wedge and similarly for \lor. LaTeX used to load a slightly modified version of plain.tex; when LaTeX2e was released, the aliases were kept for compatibility ...


6

Here is an update for bm in luatex using classic math font setup. It does not do the right thing for opentype math fonts with unicode-math (where it is not always clear what the right thing should be as most such setups do not include a bold font) \documentclass{article} \usepackage{bm} \makeatletter \def\bm@test@token#1{% \let\bm@next\@empty \ifx#1\@...


1

Not sure if this breaks other things, but here, I redefine \dot to check if the argument is a lone A and skew the dot only if that is the case (the skew level can be adjusted, of course, for the particular font). \documentclass{article} \let\svdot\dot \def\dot#1{\dothelp#1\relax} \def\dothelp#1#2\relax{% \if\relax#2\relax% \ifx A#1\skew{6}\svdot#1\...


2

I’m making this an answer because it doesn’t fit in a comment: the \mathchoice machinery is unnecessary, because the functionality it is aimed to is already built into TeX at “machine level”. See The TeXbook, Appendix G, Rule 13 (the sentence that spans the last two lines on page 443). \documentclass{article} \usepackage{mathptmx,mathtools} % ==============...


2

Adapting my answer here, Standard AMS-Sum Operator using MnSymbols?, for mathptmx, you can use either font's sum operator (\sum mathptmx and \Xsum computer modern), while retaining the underlying mathptmx math font. \documentclass{article} \usepackage{mathptmx,mathtools} % ============================================= %Import symbols from font cmex without ...


3

The learning curve vor LaTeX sure is steep, but if you have recurring tasks it will be much easier. So for the specific question of your homework I guess you will become much faster after you've done the layout two or three times. The thing I personally noticed with LaTeX is that it encourages my perfectionist side. Because I know that almost everything I ...


-1

This looks very much like \Updelta (\usepackage{ upgreek }) As you can see here, when compared with the standard Delta, the Updelta has an italic look to it.


41

The markup is completely wrong and should be removed, but to answer the question of what it means \begin{equation} $$$ \notag \displaystyle\int_{-1}^{2} x^3\:dx-\displaystyle \int_{-1}^{2} 2x\:dx \\ \\ \\ \notag \displaystyle \left. \frac{x^4}{4}\right|_{-1}^{2}-\left.\frac{2x^2}{2}\right|_{-1}^{2} \\ \\ \\ \notag \displaystyle \left. \frac{x^4}{4}\right|...


13

The $$$ directives appear to be there to cope with and work around some rather questionable coding practices embedded in your code. The instances of $$$ occur in pairs. The first instance of each pair is interpreted by TeX as $$ (end of displaymath mode that was initiated by the preceding \begin{equation} environment plus a line break) followed by $ (start ...


5

[This is not a solution but a workaround] You say, that there is an upcoming deadline and there might be no fix available until then. Here is a workaround, which requires the amsmath package (which you most probably use). It defines \bm to use the \boldsymbol macro from amsbsy (loaded automatically by amsmath). Keep in mind that there are certain ...


2

By "resizing" the summation symbols, I assume you want to enlarge them, so that they have the size used in display-math environments. This may be achieve most directly by placing \displaystyle directives ahead of \sum macros that occur in inline-math environment. This works for \int, \prod, and other so-called variable-sized operator symbols as well. ...


1

For what it's worth, you're working with a limited set of TeX functionality known as MathJax. Specifically you're forced to use a math environment, within which the following setup works: \begin{array}{l} \text{If $\dfrac{x-3}{3} = k$ and $k = 3$, what is the value of $x$?} \\ \text{A) 2} \\ \text{B) 4} \\ \text{C) 9} \\ \text{D) 10} \end{array}


7

I've found practice with LaTeX makes you faster. Now, I've got a writing disability, so writing out a good copy that other people can read takes me a long time, but I find with practice LaTeX isn't that slow. Also, the first assignment in it, getting the preamble set up and whatnot is the slowest part. After that it should be faster; I did a lot of my ...


3

For me, there's no difference between \bm and \boldmath regarding the regular symbols and numbers, \mathbf switches the font indeed and the spacing is different: \documentclass{article} \usepackage{mathtools} \usepackage{bm} \newcommand{\mathcontent}{% a=f \equiv 2 \mod 4% } \begin{document} \[ a=f \equiv 2 \mod 4\] \[\bm{a = f \equiv 2 \mod 4}\] \[\...


5

You need \bm or \boldmath, not \mathbf \documentclass{article} \usepackage{amsmath} \usepackage{bm} \begin{document} $ a=f \equiv 2 \mod 4$ $\bm{ a=f \equiv 2 \mod 4}$ {\boldmath $ a=f \equiv 2 \mod 4$} \end{document} Of course the bold symbols need to exist, not all font sets include bold.


7

Looks like a normal sans serif L, so \mathsf{L} \documentclass{article} \begin{document} $\mathsf{L}(\mathbf{z},\mathbf{x})$ \end{document}


20

The purpose of LaTeX is to make a distinction between the content (here the writing of a pair) and the rendering (the font size, the shape (bold, italic, etc.), the indentation, etc.). You code the content, and you let the rendering be processed according to predefined typographic rules (or you can tell LaTeX which 'rule' to follow). Parentheses are part of ...


3

Only a short example, without taking care about 'nice' output, with \overbrace and \underbrace and a special by mathtools: \underbracket and \overbracket \documentclass{article} \usepackage{mathtools} \begin{document} \begin{align} \underbrace{\ddot{x}^{i}}_{\text{Acceleration}} &= -\overbrace{\Gamma^{i}_{jk} \dot{x}^j \dot{x}^k}^{\text{Geodesic ...


7

As noted in a comment the two symbols are indistinguishable. When typing differential forms, use the command \wedge since the symbol is called the wedge product. (Similarly when you do wedge sums in topology.) Use \land when you use the symbol as the "logical and" symbol. When writing notes in lattice theory I would sometimes also define \newcommand*\...


9

The slanting makes the correct length of the bar a little more complicate. The following example measures the width of an upright X and uses this for the length of the bar. The solution also works for different math styles: \documentclass{article} \usepackage{amsmath,amsfonts,mathtools} \makeatletter \newcommand*{\Xbar}{}% \DeclareRobustCommand*{\Xbar}{% ...


2

Instead of sansmath use the sansmathfonts package. It automatically switches the math font to sans serif throughout the whole document (no need for \sansmath). If you want to use a font other than CM, you might run into trouble with upright uppercase greek letters as other fonts might not have them (or not have them in the correct slot). A possible ...


1

\documentclass{article} \usepackage{sansmath} \usepackage{amsmath} \begin{document} \sansmath \[ w\mathrm{\Delta} z = \operatorname{cov}(w,z) + \operatorname{E}(w\mathrm{\Delta} z), \] \end{document} Hello. To straighten the symbol in front of it is enough to add the command \mathrm{}.


1

You can also use: $\displaystyle{\lim_{x \to \infty}}$ It's in the inline mode, plus the limit is placed underneath.


2

Instead of <...> as the delimiters, you need to use \langle...\rangle: blah blah $|\left\langle R_j^{(x)},g_j^{(x)}\right\rangle|$ blah


3

Simply typing | should be completely sufficient: \begin{equation} \overline{bel}(x_{t}) = p ( x_{t} | z_{1:t-1} , u_{1:t} ) \end{equation} If you show us what the result is supposed to be, we can maybe help a little more. Please, also provide a MWE (minimum working example, that is a complete file with preamble and only what is actually needed).


5

It's how it's supposed to be, according to how lists are implemented. Any \item starts a paragraph and TeX inserts \parskip glue, that lists set equal to the value of \parsep (that's set by the class), besides \itemsep; this \itemsep doesn't get through, in this case, but \parskip does. Example (two column format for easier comparison) \documentclass[...


3

You can use CB fonts \documentclass{article} \usepackage[scaled=0.95]{helvet} \usepackage{sansmathfonts} \renewcommand{\familydefault}{\sfdefault} \DeclareFontEncoding{LGR}{}{} \DeclareSymbolFont{sfgreek}{LGR}{cmss}{m}{n} \SetSymbolFont{sfgreek}{bold}{LGR}{cmss}{bx}{n} \DeclareMathSymbol{\alpha}{\mathord}{sfgreek}{`a} \DeclareMathSymbol{\beta}{\mathord}{...


1

This answer comes following discussion in the comments to the question, to which I refer the reader. I pointed out that my solution at Upright Greek font fitting to Computer Modern works directly at unslanting a font (it is based on Bruno's answer at Shear transform a "box"). I show there how to apply it to greek letter forms, but noted that it ...


2

When in a programming language something like atan2 is written, the 2 is thought to be like a subscript. Here are two implementations, the command \atan supports both single and double argument, the latter case when followed by 2. Of course, if you mean the arctangent of 2, you have to type \atan{2} or \atan(2). \documentclass{article} \usepackage{amsmath} ...


5

The following implementation of \myprime may be what you're looking for. \newcommand\myprime{\mkern-3.5mu\raise0.6ex\hbox{$\scriptstyle\prime$}} The \mkern-3.5mu instruction shifts the material to the left, while \raise0.6ex raises it a bit. \documentclass{article} \usepackage{newpxtext,newpxmath} % Palatino clone text and math font \newcommand\myprime{...



Top 50 recent answers are included