The equation below does not display in latex. Also, the introductory text does not display properly(all words together without space and in italics)
A common form of this potential is the 12-6 Lennard Jones (LJ) potential
expressed as equation 2.7
\begin{align}
U_{ij}= 4\epsilon_{ij}[(\frac{\sigma_{ij}}{r_{ij})^12-
(\frac{\sigma_{ij}}{r_{ij})^6]
\end{align}
Also, in the text below, all words are together without space and in italics.
Where \epsilon_{ij} and \sigma{ij} represent well depth and diameter of
the atom respectively. \epsilon_{ij} and \sigma_{ij} for unlike atoms
are determined using Lorentz-Berthelot combination rules [44] given in
equations 2.8 and 2.9
Your help is appreciated.
I attach here a picture of the output.
This is because you're not using inline math mode properly. In the image you posted
it shows that your text is preceded by (what looks like) \epsilon_{ij}. \epsilon requires a math font, and therefore you should use $\epsilon_{ij}$. The same goes for any inline math you want to typeset. This would be the suggested/proper coding:
A common form of this potential is the 12-6 Lennard Jones (LJ) potential
expressed as equation~\eqref{eq:lj-potential},
\begin{equation}
U_{ij} = 4 \epsilon_{ij} [ (\frac{\sigma_{ij}}{r_{ij})^{12}
- (\frac{\sigma_{ij}}{r_{ij})^6 ] \label{eq:lj-potential}
\end{equation}
where $\epsilon_{ij}$ and $\sigma{ij}$ represent well depth and diameter of
the atom respectively. $\epsilon_{ij}$ and $\sigma_{ij}$ for unlike atoms
are determined using Lorentz-Berthelot combination rules~\cite{lorentz-berthelot}
given in equations~\eqref{eq:epsilon} and~\eqref{eq:sigma}.
Note the following:
Use equation for a single-line numbered equation; align is for multi-line equations (that may require alignment).
No blank line (paragraph break) before equation.
Use \labels and \refs (or \eqref, since you're using amsmath) since equation numbers can change. Let TeX take care of storing and recalling these numbers.
Use \cite to reference something in a bibliography.
Use $...$ (or \(...\)) for inline math (already discussed above).
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
U_{ij}= 4\epsilon_{ij}[
(\frac{
\sigma_{ij}
}{
(r_{ij})^{12} -
\frac{
\sigma_{ij}
}{(r_{ij})^6
}
}]
\end{align}
\end{document}
three groups were not closed properly in the equation.
Read about amsmath package.
I suggest you try to write as clean as possible.
Output
Related
I am writing equations in wikidocs using markdown and latex.
I tried to align the equations along the equal sign but I can't find the solution. The following is the latex that I wrote currently.
$$\begin{align}
Then,\ (x+z)+t & = x+(z+t)\ (\because Rule2) \\
& = x+0_V \\
& = x\ (\because Rule3) \\
\end{align}$$
The following is the resulted equation on the wikidocs.
I found this link
R Markdown Math Equation Alignment, but I still don't know what the problem is. Could you help me please?
As $$...$$ establishes an equation math mode environment, as does \begin{align}, it is not possible to use the align environment inside $$...$$; it can only be used (in real LaTeX source, that is) outside math mode, because it wants to switch to math mode all by itself.
You should use \begin{aligned}...\end{aligned} — note ist's aligned, not align —, as that is an environment meant to be used inside math mode. As such it is suited for use inside the $$...$$ fencing.
I ran your code on my system and it aligns just fine. Make sure you have the latest version of tools and packages installed. A minimal working example would be useful too.
I was wondering if there was a way to write exponents in LaTeX without Math Mode?
Math Mode centers the text in the middle of the paper, which is inconvenient for the paper I am trying to write.
You can use \textsuperscript{...} outside of math mode to do this. For example:
n\textsuperscript{2} for n-squared,
n\textsuperscript{th} for n-th.
My understanding is that both \textsuperscript and \textsubscript used to be part of the fixltx2e package until 2015 when they and some other commands were added directly into LaTeX so no package was needed.
I'd suggest to use $....$:
\documentclass[a4paper, ngerman, 12pt]{scrreprt}
\begin{document}
This is a blind text trying to write exponents in a textline. $a^{2}$ This is a blind text trying to write exponents in a textline.
$a^{2}$
\end{document}
The first part of the code gives you an exponent during textflow. The second part creates an exponent on the left.
I recently updated from mathematica 7.0 to 8.0, and have now encountered problem with replacing my plot labels with LaTeX code using the psfrag package. Everything worked perfectly with the earlier version and the exact same plots, but now psfrag leaves all the labels unchanged. I use Kile on Ubuntu 11.04 for LaTeX editing.
For example, in Mathematica:
plot = Plot[x, {x, -0.1, 0.1},
AxesLabel -> {eps, SUM}, BaseStyle -> {FontSize -> 10}]
Export["plot.eps", plot]
and then in LaTeX:
\begin{figure}
\psfrag{eps}{$\epsilon$}
\psfrag{SUM}{$\Sigma$}
\includegraphics{plot.eps}
\end{figure}
This should now replace labels with LaTeX typesetting, but nothing happens. Any suggestions how to solve this? Does anyone know if there is a difference in how Mathematica 8 encodes text in eps files compared to earlier versions?
There's no difference in how the EPS is encoded. The problem is that the PS code that makes the text in the v7 output (note that Mma uses bind def to create shortcuts for a lot of PS code, see the top of the generated EPS files for details):
%%IncludeResource: font Times-Roman-MISO
%%IncludeFont: Times-Roman-MISO
10 /Times-Roman-MISO Msf
0 8 m
(SUM) N
has been replaced in v8 with
%%IncludeResource: font Times-Roman-MISO
%%IncludeFont: Times-Roman-MISO
10 /Times-Roman-MISO Msf
p
0.75 9 m
(S) N
P
p
6 9 m
(U) N
P
p
14.25 9 m
(M) N
This means that psfrag can not grab hold of the tags.
I can't find how to fix this in the Mma export options.
At the moment, the only work-around I can think of (and I've tested that works) is to use single letter tags for the axes labels, e.g.
plot = Plot[x, {x, -0.1, 0.1}, AxesLabel -> {"e", "s"},
BaseStyle -> {FontSize -> 10}]
Export["plot8.eps", plot]
\begin{figure}[h]
\psfrag{e}{$\epsilon$}
\psfrag{s}{$\Sigma$}
\includegraphics{plot8.eps}
\end{figure}
Note:
The reasons for maybe wanting to use psfrag are well stated in http://www.reimeika.ca/marco/prettyplots/
Now, those tags don’t look too good
(and make little sense to boot).
However the idea is to ultimately
include the plot in a paper or report
made with LaTeX, and so the real point
to the tags is to use them as markers
for the psfrag package which allows to
replace text within EPS graphs. This
way of labeling has three big
advantages over hardcoding the tags
into the figure. First is consistency,
as the fonts will be the same as those
in the article. Second is the fact
that LaTeX's mathematical engine can
be used to the fullest extent within
the plot. Last but not least, it
allows changing notation easily within
the .tex file, as opposed to having to
recreate the plot from scratch.
Addendum:
The package psfrag only works with EPS graphics and thus only with latex.
If you want to use psfrag and pdflatex, then see the tex.SE question
Using psfrag with pdflatex
Tried both 7.0.1 and 8.0.1 and worked well for me. Hence, I cannot reproduce your error. (Maybe just a typo, case sensitivity etc.). Anyway, I agree that LateX modification is almost obligatory for publications. First I also used PSFrag, but very often I also don't like the positioning of the labels, especially if you place more complex expressions. Therefore I suggest an intermediate step via PSTricks. This looks something like this:
\documentclass[floatfig,isolatin,amsthm,amsmath,amsfont,amstext,12pt,fullpage,pslatex,amsref]{scrartcl}
\usepackage{amstext}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{float}
\usepackage{epic}
\usepackage{eepic}
\usepackage{color}
\pagestyle{empty}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(0,0)(13.0,7.8)
%\psgrid(0,0)(0,0)(13,7.8)
% need the grid only in the beginning for positioning
\rput[c](10.7,3.8){\includegraphics{plot.eps}}
% put labels.
\rput[c]{90}(9.5,4){\Large{$\frac{E^2_\text{tot}}{V M_\mathrm{S}}$}}
\rput[c]{0}(6,6.0){$x/h$}
% also to put extra lines, arrows, comments, etc. in LaTeX style, e.g.:
% \psline[linecolor=green,linewidth=2pt,linestyle=dashed]{->}(3.5,3.05)(9.1,3.05)
\end{pspicture}
\end{document}
So there is some work you have to do by hand, but usually it is worth the time as the result really looks better, especially if it is for publication. However, keep in mind that in standard settings LaTeX uses the Computer Modern Font for formulae. This is not identical with e.g. Times New Roman, the typical choice for text. You can change this with the mathptmx package.
You can write the "typeset" form in Mathematica directly, then it'll be already in the .eps file and you can just include the .eps as is.
plot = Plot[x, {x, -0.1, 0.1}, AxesLabel -> {"[\eps], [\Sigma]}, BaseStyle -> {FontSize -> 10}]
Just do [esc]+"eps"+[esc] and you'll get an epsilon, or insert it from the toolbox. Same for the sigma.
Some years ago I created a Beamer presentation (using only basic features). Unfortunetaly, I've lost the source code but still have the output PDF. Is there a convenient way to extract the original code from the presentation? Simple copy methods does not handle the mathematics well.
No, I don't think it is possible to do that. LaTeX is a typesetting language, in which you say "put a section here, this text here, some formulae here, etc., and use this style file to weight the fonts and spacing" and then compile it to PDF. The PDF document tells the PDF viewer (loosely speaking): "here's the font, place these sets of characters at these places in the document". It has no notion of section/heading/figure/equation/equation number etc.
It would be very hard to do PDF->LaTeX because of the multiple possibilities. i.e., LaTeX->PDF is a many-to-one function, so the inverse operation is going to have ambiguities.
For e.g., here's a test file using two different methods:
\documentclass{article}
\begin{document}
This is a StackOverflow test file.
\section{Method A}
\begin{equation}
ax^2+bx+c=0
\end{equation}
\end{document}
\documentclass{article}
\begin{document}
This is a StackOverflow test file.\\[0.1in]
\noindent {\Large \textbf{1\quad Method B}}
\begin{center}
$\displaystyle ax^2+bx+c=0$
\end{center}
\vspace{-0.25in}
\hfill{(1)}
\end{document}
You can see that you can't tell the two documents apart. A PDF to LaTeX converter will face the same problems.
That said, some word processing applications (open office?) can interpret PDF documents (usually only if all text) and convert it to a word document, and then you can convert that into LaTeX (usually provided by the same application). This might be one option worth trying. Other than that, there is no software that I know of that will do this for you.
I am trying to add an equation in a new line. The problem is that the equation is too long for the line, and I need to break it manually. Otherwise, it just overlaps to the right column, or to the right margins (and looks ugly...).
Is there a way LaTeX can brake the equation for me, so it seems nice?
I'm attaching my latex code:
\begin{align*}
f(n)-f(0) &= A(n)-B(n)-C(n)-D(n)\cdot d-\left(A(0)-B(0)-C(0)-D(0)\cdot d\right) \\
&= A(n)-0-X-D(n)\cdot d-\left(0-0-0-0\right) \\
&= A(n)-X-D(n)\cdot d
\end{align*}
The problematic line is the first line, which is too long.
The breqn package is designed to split long equations automatically. It works very well in the majority of situations, but it's not as mature as the amsmath package. Here's how you'd write your example equation:
\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{dmath}
f(n)-f(0) = A(n)-B(n)-C(n)-D(n)\cdot d-\left(A(0)-B(0)-C(0)-D(0)\cdot d\right)
= A(n)-0-X-D(n)\cdot d-\left(0-0-0-0\right)
= A(n)-X-D(n)\cdot d
\end{dmath}
\end{document}
Note there is no markup for alignment or newlines, but the output looks essentially the same as if you used align.
I usually prefer to handle this by using the amsmath package and using the split structure. There are a bunch of useful structures in there for splitting equations across lines, but that's usually the simplest to use.
Many TeX installations will already have the package, but you can also get it from the AMS website.
The standard approach I've used in the past is an eqnarray. See for example this page.
As far as I know, this is not possible. When working inside a display, you are responsible for line breaks. How to line break, and how to continue on the next line in case of brackets, is a tough question for humans (check, for instance, the relevant section in Grätzer, "Math into LaTeX"), let alone for a computer.
Example:
when you break the first line after \left(, you need a \right. at the end, and \left. at the beginning of the next line (otherwise you'll get an error). Moreover, you'd want the beginning of the next line to be further right than the bracket produced by \left(