在 IEEEtran 中对齐方程

在 IEEEtran 中对齐方程

我的输出 PDF 应该是这样的 参考PDF

相反,它看起来像

在此处输入图片描述

你能帮助我吗?我只显示第二页,因为我的 pdf 的第一页和参考 pdf 是相同的。这里我展示我的代码。提前谢谢!

\documentclass[a4paper, 10pt, conference]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage[ruled,vlined]{algorithm2e}
\SetKw{KwVar}{Variables:}
\begin{document}
\title{A Sample \LaTeX Article}

\author{xxx\\Universidad de Málaga, Escuela de Ingenierías Industriales\\29071-Málaga, Spain}
\date{\today}
\maketitle

\begin{abstract}
    This a sample document that reviews some aspects of \LaTeX to practice with them for a Master subject\footnote{\textit{"Escritura y Comunicación de Publicaciones de Investigación en Ingeniería"}}.
\end{abstract}

\section{Introduction}
\LaTeX{} is a markup language designed and implemented by \textbf{Leslie Lamport}, based on \textbf{Donald E. Knuth’s} typesetting language \TeX{}. The notation in the source file may appear somewhat challenging, but the compiled document is certainly a pleasing rendering of the text. 

\TeX{} comes with a set of fonts called Computer Modern (CM). Additional fonts designed for use in mathematics are provide by the American Mathematical Society (AMS). \TeX{} is expandable, that is, additional commands can be defined in terms of more basic ones. One of the best known expansions of \TeX{} is \LaTeX{} (see Fig. \ref{fig:example}. Add-on features for LATEX are known as packages. Dozens of these are pre-installed and can be used immediately.

An article is divided into \textit{logical units}, including various sections and subsections, and a bibliography. This is specified by the document class. Once all the units have been typed, \LaTeX{} controls the \textit{placement} and \textit{formating} of these elements. \LaTeX{} automatically numbers the sections and equations in your article, and builds the cross-references. If any change is made to the article, it automatically renumbers its various parts and rebuilds the cross-references.

\LaTeX{} commands, as a rule, start with a backslash (\textbackslash). \textit{Environments} are used to format blocks of text in a document. Each \textit{comment} line begins with \%. \LaTeX{} will ignore everything on the line after the \% character.

\section{Examples}
\subsection{Table}
Table \ref{Tab:mydata} shows some common extensions related with \LaTeX{} files.

\begin{table}[h]
\centering
\caption{Common file extensions in \LaTeX{}.} \label{Tab:mydata} 
\begin{tabular}{c|l} 

Extension & File \\ 
\hline
\texttt{.tex} & input   \\ 
\texttt{.pdf} & output\\ 
\texttt{.aux} & auxiliary\\
\texttt{.cls} & document class\\
\texttt{.bib} & references\\
\texttt{.bst} & bibliography style\\
\end{tabular} 
\end{table}

\begin{figure}[b!]
    \centering % Center figure
    \includegraphics[width= 0.7\columnwidth]{figure.pdf}
    \caption{\LaTeX{} foundation.}
    \label{fig:example}
\end{figure}

\subsection{List}
The same information contained in \ref{Tab:mydata} can be found in the following list:
\begin{itemize} 
\item[] \texttt{.text} is the input text file.
\item[] \texttt{.pdf} is the output file.
\item[] \texttt{.aux} refers to an auxiliary file for the compiler.
\item[] \texttt{.cls} defines a document class file.
\item[] \texttt{.bib} contains the references of the document.
\item[] \texttt{.bst} defines the style for the biography.\end{itemize}
\subsection{References}
Next, some examples on how to cite works from a journal \cite{Rieger:2010}, a conference \cite{Scaramuzza:2007}, a book \cite{Thrun:2005}, a chapter of a book \cite{Ollero:1997} and a web page \cite{IAIS:2013} can be found.

\section*{Acknowledgements}
This work was not supported by any research project.

\bibliographystyle{IEEEtran}
\bibliography{BIBLIOGRAFIA.bib}




\section*{Appendix}

\begin{equation} \label{eq:1}
(sI-A)^{-1}=\frac{\textrm{adjoint(}sI-A\textrm{)}}{\lvert sI-A \rvert} \Rightarrow G(s)=\frac{C\,\textrm{adjoint(}sI-A\textrm{)}B+D\lvert sI-A \rvert}{\lvert sI-A \rvert}\end{equation}

This appendix presents equations \eqref{eq:1} to \eqref{eq:6} and the algorithm \ref{alg:1}.

\begin{equation} \label{eq:2} \left( \begin{array}{ccc}
G_{11}(s) & \cdots & G_{1p}(s)\\
\vdots & \ddots & \vdots\\
G_{m1}(s) & \cdots & G_{mp}(s)
\end{array} \right) \left( \begin{array}{c}
U_{1}(s)\\
\vdots\\
U_{p}(s)
\end{array} \right),  \end{equation}

\begin{equation} \label{eq:3}
    x(t)=e^{At}x(0)+e^{At}\int_0^1 e^{-A\tau}\,B\,u\,(\tau)\,d\tau,
\end{equation}

\begin{equation} \label{eq:4}
    x(k+1)=x(k)\Rightarrow \begin{cases}
    x_{1e}=-0.116r,\\
    x_{2e}=y_{e}=0.142r, \end{cases}
\end{equation}

\begin{equation} \label{eq:5}
(sI-A)^{-1}=\frac{\sum\limits_{i=0}^{n-1}(A_is^i)}{P_{\alpha}(s)},
\end{equation}

\begin{align} \label{eq:6}
E[v(t_{1})v^{T}(t_2)]=R\delta(t_1,t_2),&\quad E[v(t_{1})w^{T}(t_2)]=0, \nonumber \\
E[w(t_{1})w^{T}(t_2)]=Q\delta(t_1,t_2),&\quad E[w(t_{1})v^{T}(t_2)]=0,
\end{align}

\begin{algorithm} \label{alg:1}
% \SetAlgoLined
\DontPrintSemicolon
\KwIn{$L, \sigma$}
\KwVar{$M, I, R$}\\
Initialize $M \leftarrow -1 $ \% Matrix of size $i^{max}_x\cdot i^{max}_y$\\
$R\leftarrow\{\} \%$ List of removed cubes\\
Sort List $L$ in increasing order of indices $I$\\
Access to the first index $I$ of $L$.\\
 \Repeat{I==NULL;}{
  $(i_x,i_y,y_zt)\leftarrow I$;\\
  \If{$M(i_x,i_y)=-1$}{
   $M(i_x,i_y)=i_z$\;
   }
   \ElseIf{$(i_z-M(i_x,i_y))\geq\sigma$}{
   $R\leftarrow\{R,I\} \%$ Let the cube collapse\;
   \Else{}{
    $M(i_x,i_y)=i_z$\;
   }
  }
  Access to the next index $I$ of $L$
 }
 \KwResult{Sorted list $R$ with cubes from overhangs}
 \caption{The collapsible cubes algorithm}
\end{algorithm}

\end{document}

答案1

您的文档使用双列布局。恐怕我不明白为什么公式应该横跨两列。我会使用环境gathered来引入换行符,以便让材料适合一列。

在此处输入图片描述

\documentclass[a4paper,10pt,conference]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{mathtools}
\DeclareMathOperator{\adjoint}{adjoint}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}

\begin{document}
\hrule % just to illustrate width of textblock
\section*{Appendix}

\begin{equation} \label{eq:1}
\begin{gathered}
(sI-A)^{-1}=\frac{\adjoint(sI-A)}{\abs{sI-A}} \\
\Rightarrow G(s)=\frac{C\adjoint(sI-A)B+D\abs{sI-A}}{\abs{sI-A}}
\end{gathered}
\end{equation}
\hrule % just to illustrate width of textblock
\end{document}

答案2

也许,以下两个包可能会对您有所帮助。包strip中的环境cuted允许您在两列中编写公式。并且flushend包将允许您平衡列,以便将算法放在第二列中。

\documentclass[a4paper, 10pt, conference]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage[ruled,vlined]{algorithm2e}

\usepackage{cuted}
\usepackage{flushend}

\SetKw{KwVar}{Variables:}
\begin{document}
\title{A Sample \LaTeX Article}

\author{Antonio Justicia Ruiz\\Universidad de Málaga, Escuela de Ingenierías Industriales\\29071-Málaga, Spain}
\date{\today}
\maketitle

\begin{abstract}
    This a sample document that reviews some aspects of \LaTeX to practice with them for a Master subject\footnote{\textit{"Escritura y Comunicación de Publicaciones de Investigación en Ingeniería"}}.
\end{abstract}

\section{Introduction}
\LaTeX{} is a markup language designed and implemented by \textbf{Leslie Lamport}, based on \textbf{Donald E. Knuth’s} typesetting language \TeX{}. The notation in the source file may appear somewhat challenging, but the compiled document is certainly a pleasing rendering of the text. 

\TeX{} comes with a set of fonts called Computer Modern (CM). Additional fonts designed for use in mathematics are provide by the American Mathematical Society (AMS). \TeX{} is expandable, that is, additional commands can be defined in terms of more basic ones. One of the best known expansions of \TeX{} is \LaTeX{} (see Fig. \ref{fig:example}. Add-on features for LATEX are known as packages. Dozens of these are pre-installed and can be used immediately.

An article is divided into \textit{logical units}, including various sections and subsections, and a bibliography. This is specified by the document class. Once all the units have been typed, \LaTeX{} controls the \textit{placement} and \textit{formating} of these elements. \LaTeX{} automatically numbers the sections and equations in your article, and builds the cross-references. If any change is made to the article, it automatically renumbers its various parts and rebuilds the cross-references.

\LaTeX{} commands, as a rule, start with a backslash (\textbackslash). \textit{Environments} are used to format blocks of text in a document. Each \textit{comment} line begins with \%. \LaTeX{} will ignore everything on the line after the \% character.

\section{Examples}
\subsection{Table}
Table \ref{Tab:mydata} shows some common extensions related with \LaTeX{} files.

\begin{table}[h]
\centering
\caption{Common file extensions in \LaTeX{}.} \label{Tab:mydata} 
\begin{tabular}{c|l} 

Extension & File \\ 
\hline
\texttt{.tex} & input   \\ 
\texttt{.pdf} & output\\ 
\texttt{.aux} & auxiliary\\
\texttt{.cls} & document class\\
\texttt{.bib} & references\\
\texttt{.bst} & bibliography style\\
\end{tabular} 
\end{table}

\begin{figure}[b!]
    \centering % Center figure
    %\includegraphics[width= 0.7\columnwidth]{figure.pdf}
    \caption{\LaTeX{} foundation.}
    \label{fig:example}
\end{figure}

\subsection{List}
The same information contained in \ref{Tab:mydata} can be found in the following list:
\begin{itemize} 
\item[] \texttt{.text} is the input text file.
\item[] \texttt{.pdf} is the output file.
\item[] \texttt{.aux} refers to an auxiliary file for the compiler.
\item[] \texttt{.cls} defines a document class file.
\item[] \texttt{.bib} contains the references of the document.
\item[] \texttt{.bst} defines the style for the biography.\end{itemize}
\subsection{References}
Next, some examples on how to cite works from a journal \cite{Rieger:2010}, a conference \cite{Scaramuzza:2007}, a book \cite{Thrun:2005}, a chapter of a book \cite{Ollero:1997} and a web page \cite{IAIS:2013} can be found.

\section*{Acknowledgements}
This work was not supported by any research project.

\bibliographystyle{IEEEtran}
%\bibliography{BIBLIOGRAFIA.bib}

\pagebreak

\begin{strip}
\begin{equation} \label{eq:1}
(sI-A)^{-1}=\frac{\textrm{adjoint(}sI-A\textrm{)}}{\lvert sI-A \rvert} \Rightarrow G(s)=\frac{C\,\textrm{adjoint(}sI-A\textrm{)}B+D\lvert sI-A \rvert}{\lvert sI-A \rvert}
\end{equation}
\end{strip}

\section*{Appendix}

This appendix presents equations \eqref{eq:1} to \eqref{eq:6} and the algorithm \ref{alg:1}.

\begin{equation} \label{eq:2} \left( \begin{array}{ccc}
G_{11}(s) & \cdots & G_{1p}(s)\\
\vdots & \ddots & \vdots\\
G_{m1}(s) & \cdots & G_{mp}(s)
\end{array} \right) \left( \begin{array}{c}
U_{1}(s)\\
\vdots\\
U_{p}(s)
\end{array} \right),  \end{equation}

\begin{equation} \label{eq:3}
    x(t)=e^{At}x(0)+e^{At}\int_0^1 e^{-A\tau}\,B\,u\,(\tau)\,d\tau,
\end{equation}

\begin{equation} \label{eq:4}
    x(k+1)=x(k)\Rightarrow \begin{cases}
    x_{1e}=-0.116r,\\
    x_{2e}=y_{e}=0.142r, \end{cases}
\end{equation}

\begin{equation} \label{eq:5}
(sI-A)^{-1}=\frac{\sum\limits_{i=0}^{n-1}(A_is^i)}{P_{\alpha}(s)},
\end{equation}

\begin{align} \label{eq:6}
E[v(t_{1})v^{T}(t_2)]=R\delta(t_1,t_2),&\quad E[v(t_{1})w^{T}(t_2)]=0, \nonumber \\
E[w(t_{1})w^{T}(t_2)]=Q\delta(t_1,t_2),&\quad E[w(t_{1})v^{T}(t_2)]=0,
\end{align}

\break
\begin{algorithm} \label{alg:1}
% \SetAlgoLined
\DontPrintSemicolon
\KwIn{$L, \sigma$}
\KwVar{$M, I, R$}\\
Initialize $M \leftarrow -1 $ \% Matrix of size $i^{max}_x\cdot i^{max}_y$\\
$R\leftarrow\{\} \%$ List of removed cubes\\
Sort List $L$ in increasing order of indices $I$\\
Access to the first index $I$ of $L$.\\
 \Repeat{I==NULL;}{
  $(i_x,i_y,y_zt)\leftarrow I$;\\
  \If{$M(i_x,i_y)=-1$}{
   $M(i_x,i_y)=i_z$\;
   }
   \ElseIf{$(i_z-M(i_x,i_y))\geq\sigma$}{
   $R\leftarrow\{R,I\} \%$ Let the cube collapse\;
   \Else{}{
    $M(i_x,i_y)=i_z$\;
   }
  }
  Access to the next index $I$ of $L$
 }
 \KwResult{Sorted list $R$ with cubes from overhangs}
 \caption{The collapsible cubes algorithm}
\end{algorithm}

\end{document}

在此处输入图片描述

相关内容