使用本序言
\documentclass[a4paper,oneside,abstracton]{scrartcl}
\usepackage[utf8]{inputenc}
%\usepackage[latin1]{inputenc} %Zeichencodierung Text
\usepackage[T1]{fontenc} %Schriftsatz Dokument
%%Language settings
\usepackage[english]{babel} %ngerman for German
\usepackage{csquotes} %[babel,quotes=english]
\usepackage{caption}
\addto\captionsenglish{\renewcommand{\contentsname}{Table of Contents}}
%\renewcommand{\contentsname}{Table of Contents} % only works when not using babel
%%Math, astro, chemical packages and options
\usepackage{amsmath,amssymb,amsthm,amsfonts,amsbsy,latexsym}
\usepackage{mathtools}
\usepackage{wasysym} %astronomical symbols
%\usepackage[version=3]{mhchem} %Chemie-Package
\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}
%\usepackage{dsfont}
%\usepackage{enumerate,url}
%%Paper adjustments
\usepackage{graphicx}
\usepackage{epstopdf} %if problems with importing .eps graphics
%\usepackage{a4wide} %obsolete and replaced by geometry
\usepackage[a4paper,bottom=3.1cm]{geometry} %also with command \geometry{options}
\usepackage{changepage}
\usepackage{titling}
\usepackage{booktabs}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{threeparttable}
%\usepackage{subfigure} %obsolete
\usepackage{subcaption} %cannot be used with subfigure
%\usepackage{subfig}
%\addto\captionsngerman{\renewcommand{\figurename}{Fig.}}
\usepackage{afterpage}
\usepackage{textcomp, gensymb} %textcomp before gensymb gets rid of the warnings "not defining \micro and \perthousand
\usepackage{soul} %for customised working with the text
\usepackage{array}
\setcounter{secnumdepth}{4} %sets the section number depth
\setcounter{tocdepth}{4} %sets the ToC depth
%\usepackage{verbatim} %for multiline comments using \begin{} or \end{comment}
\usepackage{xcolor} %colour e.g. parts of equations
%% Control the fonts and formatting used in the table of contents.
%\usepackage[titles]{tocloft}
%% Aesthetic spacing redefined
%\setlength{\cftbeforechapskip}{}
%\setlength{\cftbeforesecskip}{0.5ex}
\setlength{\parindent}{0pt} %kein Einrücken von neuen Abschnitten
\usepackage{afterpage} %to avoid space before landscape-environment
为什么我会得到这个方程的错误:
\begin{document}
\begin{equation*}
\begin{aligned}
{}^{16}_{\phantom{0}8}O^{}_{8} + n &\rightarrow
{}^{17}_{\phantom{0}8}O^{*}_{9} \:\: \rightarrow {}^{17}_{\phantom{0}8}O^{}_{9} + \gamma
\\
{}^{17}_{\phantom{0}8}O^{}_{9} + n &\stackrel{\mathclap}{\rightarrow} {}^{18}_{\phantom{0}8}O^{*}_{10} \rightarrow
{}^{18}_{\phantom{0}8}O^{}_{10} + \gamma
\\
{}^{18}_{\phantom{0}8}O^{}_{10} + n &\stackrel{\mathclap}{\rightarrow} {}^{19}_{\phantom{0}8}O^{*}_{11} \rightarrow
{}^{19}_{\phantom{0}8}O^{}_{11} + \gamma
\end{aligned}
\end{equation*}
\end{document}
有对齐错误、\cr 错误、\mathpalette 错误、{ 和 } 错误。我就是看不出问题所在。我遇到的错误有什么解决办法?
答案1
这或许就是您想要得到的?
\documentclass{article}
\usepackage{amsmath}
\usepackage{mhchem}
\newcommand{\st}{\makebox[0pt][l]{$^{*}$}}
\begin{document}
\begin{equation*}
\begin{alignedat}{7}
&\ce{^{16}_{8}O8} &&+ n\quad && \rightarrow{}\quad&&
\ce{^{17}_{8}O\st 9} &&\rightarrow{} &&\ce{^{17}_{8}O9} &&+ \gamma
\\
&\ce{^{17}_{8}O9} &&+ n && &&
\ce{^{18}_{8}O\st 10} &&\rightarrow{} &&\ce{^{18}_{8}O10} &&+ \gamma
\\
&\ce{^{18}_{8}O10} &&+ n && &&
\ce{^{19}_{8}O\st 11} &&\rightarrow{} &&\ce{^{19}_{8}O11} &&+ \gamma
\end{alignedat}
\end{equation*}
\end{document}
如果您希望第一个箭头周围的空间更小,请删除\quad
命令。如果您希望其他行中也有箭头,请像第一行一样重新添加箭头。
一种可能更简单的方法array
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}
\usepackage{mhchem}
\newcommand{\st}{\makebox[0pt][l]{$^{*}$}}
\begin{document}
\begin{equation*}
\begin{array}{
@{}
l @{}
>{{}}l @{\quad}
>{{}}c<{{}} @{\quad}
>{{}}l @{}
>{{}}c<{{}} @{}
l @{}
>{{}}l @{}
}
\ce{^{16}_{8}O8} & + n & \rightarrow &
\ce{^{17}_{8}O\st 9} & \rightarrow & \ce{^{17}_{8}O9} & + \gamma
\\\addlinespace
\ce{^{17}_{8}O9} & + n & &
\ce{^{18}_{8}O\st 10} & \rightarrow & \ce{^{18}_{8}O10} & + \gamma
\\\addlinespace
\ce{^{18}_{8}O10} & + n & &
\ce{^{19}_{8}O\st 11} & \rightarrow & \ce{^{19}_{8}O11} & + \gamma
\end{array}
\end{equation*}
\end{document}
答案2
更紧密的变体,具有alignedat
更少的对齐点:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mhchem}
\newcommand{\st}{\makebox[0pt][l]{$^{*}$}}
\begin{document}
\begin{equation*}
\begin{alignedat}{4}
&\ce{^{16}_{8}O8} &{}+n\rightarrow{} & \ce{^{17}_{8}O\st 9} &{}\rightarrow{} & \ce{^{17}_{8}O9}&{}+ \gamma
\\
&\ce{^{17}_{8}O9}&{}+n\rightarrow{} & \ce{^{18}_{8}O\st 10} & {}\rightarrow{} & \ce{^{18}_{8}O10} & {}+ \gamma
\\
&\ce{^{18}_{8}O10}&{}+ n\rightarrow{} & \ce{^{19}_{8}O\st 11} &{}\rightarrow{}& \ce{^{19}_{8}O11} & {}+ \gamma
\end{alignedat}
\end{equation*}
\end{document}