如何在对齐环境中添加任意水平间距?\hspace{} 和 \qquad 不起作用。
\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}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amsbsy}
\usepackage{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
{}^{15}_{\phantom{0}8}O^{}_{7} + 2n
\\
{\hspace{17.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{*}_{8} + {e}^{+} + \nu
\\
{\hspace{38.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{}_{8} + \gamma
\end{aligned}
\end{equation*}
\end{document}
答案1
的第一个字段是右对齐的,因此在每行的开头aligned
添加(因为的第二个字段是左对齐的)。&
aligned
\documentclass{article}
\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}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amsbsy}
\usepackage{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
{}^{15}_{\phantom{0}8}O^{}_{7} + 2n
\\
&{\hspace{17.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{*}_{8} + {e}^{+} + \nu
\\
&{\hspace{38.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{}_{8} + \gamma
\end{aligned}
\end{equation*}
\end{document}
如果您的目标是实现左对齐,\hspace
则无需使用,只需使用字段分隔符:
\begin{aligned}
&{}^{16}_{\phantom{0}8}O^{}_{8} + n \rightarrow
{}^{15}_{\phantom{0}8}O^{}_{7} + 2n
\\
&\searrow {}^{15}_{\phantom{0}7}N^{*}_{8} + {e}^{+} + \nu
\\
&\searrow {}^{15}_{\phantom{0}7}N^{}_{8} + \gamma
\end{aligned}
跟进:
为了帮助 OP 理解什么aligned
,我提供了这个例子来演示如何使第一个字段(在 之前&
)右对齐,以及如何使第二个字段(在 之后&
)左对齐(同时考虑\hspace
)。
\begin{aligned}
xxx&{}^{16}_{\phantom{0}8}O^{}_{8} + n \rightarrow
{}^{15}_{\phantom{0}8}O^{}_{7} + 2n
\\
yy&{\hspace{17.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{*}_{8} + {e}^{+} + \nu
\\
z&{\hspace{38.5mm} \searrow} {}^{15}_{\phantom{0}7}N^{}_{8} + \gamma
\end{aligned}
根据 OP 的评论,也许他对语法高亮感到困惑:
在这种情况下,不同的颜色并不一定意味着错误,而是有助于输入良好代码的视觉辅助。我希望&
好的编辑器能够突出显示这些内容(如上图 TeXworks 所示)。