我使用 LaTeX 很长时间了,并且使用了eqnarry
。但那已经过时了,所以我equation
尝试aligned
了一下。问题是,如果我引用我的公式,它会显示章节编号(?)
,但在公式右侧显示错误的编号。
...siehe Gleichung \ref{form:casteljau}.
\begin{equation}
\begin{aligned}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1...n, i+j+k = n-l
\end{aligned}
\label{form:casteljau}
\end{equation}
看起来像这样:
siehe Gleichung 2.6.2.
"equation" ____________________________(2.12)
"equation"
所以我尝试了subequations
和align
。现在我在文本中得到了正确的编号(2.13),但是等式的右侧没有数字,而通常情况下是这样。
....siehe Gleichung \eqref{form:casteljau}.
\begin{subequations}
\begin{align*}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1...n, i+j+k = n-l
\end{align*}
\label{form:casteljau}
\end{subequations}
看起来像这样:
siehe Gleichung 2.13.
"equation" ____________________________
"equation"
顺便说一句,下划线实际上并不存在,但它删除了我的空格,所以我使用了___s 有人能给我正确的组合吗?因为很多博客都说这应该可行,但实际上不行。还有什么我可以发布的吗?
这里是编译主文档:
\documentclass[12pt,a4paper,oneside]{scrbook}
%\usepackage{showframe}
% German stuff
\usepackage[latin1]{inputenc} % so can use Umlaut chars
\usepackage[ngerman]{babel} % load babel *before* natbi [english]
\usepackage[normal,small,bf]{caption} % normal, hang, center, nooneline, Large
% mathematical Symboles
\usepackage{amsmath,amssymb,amsfonts,amstext,chemarr}
%\numberwithin{equation}{chapter}
\usepackage[bf,sf]{subfigure}
\renewcommand{\subfigtopskip}{0mm}
\renewcommand{\subfigcapmargin}{0mm}
\renewcommand{\chaptername}{}
\linespread{1.3} % 1.5facher Zeilenabstand
\usepackage{setspace}
\onehalfspacing
\usepackage{comment}
\usepackage{listings}
\usepackage{ulem} %dashuline
\usepackage[nolist]{acronym}%nolist printonlyused printonlyused,withpage
\usepackage{wrapfig}
% citations
\usepackage[numbers,square]{natbib}
\usepackage{url}
\usepackage{latexsym}
\usepackage{longtable}
\usepackage{ifpdf} % detect outputstyle
% Free Header and Footer
\usepackage{fancyhdr}
%first[]-> even pages; second [] -> odd pages
\lfoot[\fancyplain{}{}]{\fancyplain{}{}}
\rfoot[\fancyplain{}{}]{\fancyplain{}{}}
\cfoot[\fancyplain{}{\footnotesize\thepage}]{\fancyplain{}{\footnotesize\thepage}}
\lhead[\fancyplain{}{\footnotesize\nouppercase\sc\leftmark}]{\fancyplain{}{}}
\chead{}
\rhead[\fancyplain{}{}]{\fancyplain{}{\footnotesize\nouppercase\sc\leftmark}}
% Color in Document
\usepackage{color}
\usepackage{colortbl} %define colored backgrounds for tables
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\definecolor{orange}{rgb}{0.0,0.0,1.0}
\definecolor{yac}{rgb}{0.0,0.5,0.5}
\definecolor{middlegray}{rgb}{0.5,0.5,0.5}
\usepackage{array}
\ifpdf
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.jpg,.png,.gif}
\pdfcompresslevel=9
\pdfpageheight=290mm
\pdfpagewidth=210mm
\usepackage[ % hyperref should be last package loaded
pdftex,
bookmarks,
bookmarksnumbered,
linktocpage,
pagebackref,
pdfview={Fit},
pdfstartview={Fit},
pdfpagemode=UseOutlines, % open bookmarks in Acrobat
]{hyperref} % for Querverweise
\usepackage{bookmark}
\else % latex
\usepackage{graphicx}
\DeclareGraphicsExtensions{.ps}
\fi
\usepackage{epstopdf} %gordon: for displaying eps images
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
rulecolor=,
emph={a,b,c},
language=c++,
basicstyle=\scriptsize\ttfamily,
upquote=true, %compile with pdflatex
aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=true,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=tlrb,
numbers=left,
numberstyle=\tiny,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\bfseries\ttfamily\color{orange},
stringstyle=\color{middlegray}\ttfamily,
commentstyle=\color{yac}\ttfamily,
}
\setlength{\parskip}{3pt plus 1pt minus 0pt} % vert. space before a paragraph
\setcounter{tocdepth}{2} % lowest section level entered in ToC
\setcounter{secnumdepth}{3} % lowest section level still numbered
% --- Start of Document ----------------------------------------
\begin{document}
\setcounter{page}{1}
\pagenumbering{roman} %roemische ziffern
\pagestyle{plain} % Initialize Header and Footer
\include{title} % Title Page
\include{empty} % Empty Page
\include{affidavit} % affidavit
\include{abstracts} % Englisch and German abstracts
\include{acknowl} % Acknowledgements
\include{abbreviation} % Abkuerzungen
\include{toc} % Table of Contents
%--- Include your chapters here ----------
\setcounter{page}{1}
\pagenumbering{arabic}
\pagestyle{fancy} % Initialize Header and Footer
\include{chapter1} % Introduction
\include{chapter2} % Background
\include{chapter4} % Technische Umsetzung
\include{chapter6}
\pagenumbering{roman} %roemische ziffern
\pagestyle{plain} % Initialize Header and Footer
\appendix
\include{glossary} % Glossary
\include{appendix} % Appendix A
\end{document}
答案1
我不清楚你是否希望方程编号(例如,(2.13))只适用于两行方程结构的第一行,还是应该适用于两行。无论如何,不要使用align*
环境里面环境subequations
,因为align*
环境是被设计的不是显示方程式编号。
如果您只想对双行系统的第一行进行编号,我建议您使用环境align
并使用命令\notag
来抑制第二行的方程编号。如果您希望方程编号与两行同等相关,我建议您在环境split
内使用环境equation
。观察\label
两种情况下指令的位置。
\documentclass{book}
\usepackage{amsmath}
\numberwithin{equation}{chapter}
\begin{document}
\setcounter{chapter}{2} % just for this example
\setcounter{equation}{12}
\dots\ siehe Gleichung \eqref{form:casteljau}.
\begin{align}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k}
+ v\mathbf{p}^{l-1}_{i,j+1,k}
+ (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \label{form:casteljau}\\
l &= 1,\dots,n; \quad i+j+k = n-l \notag
\end{align}
\begin{equation}\label{form:casteljau_new}
\begin{split}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k}
+ v\mathbf{p}^{l-1}_{i,j+1,k}
+ (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1,\dots,n; \quad i+j+k = n-l
\end{split}
\end{equation}
\dots\ siehe Gleichung \eqref{form:casteljau_new}.
\end{document}
另一个建议:由于您的公式同时包含1
和,您可能希望使用而不是来l
在两个符号之间提供更多的视觉区别。第一组方程式将如下所示:\ell
l
答案2
我不知道我是否理解了你的问题。
\documentclass{book}
\usepackage{hyperref}
\usepackage{amsmath}
\numberwithin{equation}{chapter} %numbering within chapter
\begin{document}
\chapter{a}
....siehe Gleichung~\ref{bbb}.
\begin{align}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \label{aaa} \\
l &= 1...n, i+j+k = n-l \label{bbb}
\end{align}
\begin{align}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \nonumber \\ %without equation number
l &= 1...n, i+j+k = n-l.
\end{align}
\end{document}
答案3
好的,我做了一些测试,结合了我的代码和你的代码,问题仍然存在。(抱歉我的写作方式令人困惑......)顺便说一下,我正在使用 pdflatex。
\documentclass{scrbook}
\usepackage{amsmath}
\numberwithin{equation}{chapter}
\begin{document}
\setcounter{chapter}{2} % just for this example
\setcounter{equation}{12}
See equation tangentSpace0 \ref{form:tangentSpace0}, form:tangentSpace1 \ref{form:tangentSpace1}, form:tangentSpace2 \ref{form:tangentSpace2}.
\begin{eqnarray}
E_{V2-V1} = V2.xyz - V1.xyz =
\begin{pmatrix}
18 - 0\\
18 - 18\\
0 - 0
\end{pmatrix}
=
\begin{pmatrix}
18\\
0\\
0
\label{form:tangentSpace0}
\end{pmatrix}
\end{eqnarray}
\nonumber\\
\begin{eqnarray}
E_{V2-V1} = V2.uv - V1.uv =
\begin{pmatrix}
1 - 0\\
0 - 0
\end{pmatrix}
=
\begin{pmatrix}
1\\
0
\label{form:tangentSpace1}
\end{pmatrix}
\end{eqnarray}
\\
\begin{eqnarray}
T_{unnormalisiert} = E_{V2-V1}.xyz / E_{V2-V1}.u =
\begin{pmatrix}
18 / 1\\
0 / 1\\
0 / 1
\end{pmatrix}
=
\begin{pmatrix}
18\\
0\\
0
\label{form:tangentSpace2}
\end{pmatrix}
\end{eqnarray}
\dots\ your version: form:casteljau \eqref{form:casteljau}.
\begin{align}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k}
+ v\mathbf{p}^{l-1}_{i,j+1,k}
+ (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \label{form:casteljau}\\
l &= 1,\dots,n; \quad i+j+k = n-l \notag
\end{align}
\dots\ your version: form:casteljau\_new \eqref{form:casteljau_new}.
\begin{equation}\label{form:casteljau_new}
\begin{split}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k}
+ v\mathbf{p}^{l-1}_{i,j+1,k}
+ (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1,\dots,n; \quad i+j+k = n-l
\end{split}
\end{equation}
...my old version with equation and aligned: form:casteljau1 \ref{form:casteljau1}.
\begin{equation}
\begin{aligned}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1...n, i+j+k = n-l
\end{aligned}
\label{form:casteljau1}
\end{equation}
...my old version with subequations and align form:casteljau2 \eqref{form:casteljau2}.
\begin{subequations}
\begin{align}
\mathbf{p}^{l}_{i,j,k} &= u\mathbf{p}^{l-1}_{i+1,j,k} + v\mathbf{p}^{l-1}_{i,j+1,k} + (1-u-v)\mathbf{p}^{l-1}_{i,j,k+1} \\
l &= 1...n, i+j+k = n-l
\end{align}
\label{form:casteljau2}
\end{subequations}
and eqnarry again: form:tangentSpace3 \ref{form:tangentSpace3}
\begin{eqnarray}
T_{unnormalisiert} = E_{V2-V1}.xyz / E_{V2-V1}.u =
\begin{pmatrix}
18 / 1\\
0 / 1\\
0 / 1
\end{pmatrix}
=
\begin{pmatrix}
18\\
0\\
0
\label{form:tangentSpace3}
\end{pmatrix}
\end{eqnarray}
\end{document}
如下图所示:
右侧的编号太混乱了。我还仔细检查了标签名称和引用名称。看起来你真的不能将 eqnarray 与其他包混合使用...请问有人可以复制该代码并查看结果是否相同吗?!
好的,你可以将它们混合起来,编译大约 5 次之后它看起来是正确的。
但是如果我在工作中尝试它,第 6 次编译之后它仍然看起来像这样: 下面的等式没有编号并且参考显示 2.6.2(那是章节...)