测量长度导致错误的方程式对齐

测量长度导致错误的方程式对齐

请原谅我的语言贫乏和不专业的问题,但我需要了解更多。

我为命令写了两个定义,第一个命令在注释中将当前的 X 位置和 Y 位置写入方程框之前,第二个命令在另一个注释中将当前的 X 位置和 Y 位置写入方程框之后,生成 PDF 后我注意到带有多个标签的方程式未在“=”符号处对齐,删除这 2 个命令后,方程式在“=”符号处正确对齐。

以下是我的命令

\def\BEQN{\special{<!-- BEQN: "{?x}" "{?y}" -->{?nl}}}
\def\EEQN{\special{<!-- EEQN: "{?x}" "{?y}" -->{?nl}}}

我使用这些命令如下:

\let\rendsplit@old=\rendsplit@
\def\rendsplit@{%
   \global\setbox\z@\vbox{\hbox{\BEQN\vbox{\unvcopy\z@}\EEQN}}%
  \rendsplit@old%
} 

因此,当我删除命令\BEQN\EEQN使用前一部分的\hbox外部命令时\vbox,方程式正确对齐,并且前一部分如下所示:

\global\setbox\z@\vbox{\unvcopy\z@}%

这是我的完整代码示例

    \PassOptionsToPackage{draft}{hyperref}
\documentclass[final]{tc}


\usepackage{colortbl}
\usepackage{chemarr}
\usepackage{extarrows}
\usepackage{cancel}



%\usepackage[paperwidth=\maxdimen,paperheight=\maxdimen]{geometry}

\usepackage[active,tightpage,displaymath,textmath]{preview}


\usepackage{multirow,array,eurofont,rotating}

\usepackage{etex}

\input{declaremath.tex}

\input{statement.tex}

%\setlength{\PreviewBorder}{0.05pt}

\makeatletter
\def\BEQN{\special{dvisvgm:raw{?nl}<!-- BEQN: "{?x}" "{?y}" -->{?nl}}}
\def\EEQN{\special{dvisvgm:raw<!-- EEQN: "{?x}" "{?y}" -->{?nl}}}

\def\BLBL{\special{dvisvgm:raw<g class="label">{?nl}<!-- BLBL: "{?x}" -->{?nl}}}
\def\ELBL{\special{dvisvgm:raw<!-- ELBL: "{?x}" -->{?nl}</g>{?nl}}}

\renewenvironment{gathered}[1][c]{%
    \RIfM@\else
        \nonmatherr@{\begin{gathered}}%
    \fi
    \null\,%
    \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi \bgroup
        \Let@ \chardef\dspbrk@context\@ne \restore@math@cr
        \spread@equation
        \ialign\bgroup
            \hfil\strut@\BEQN$\m@th\displaystyle##$\EEQN\hfil
            \crcr
}{%
  \endaligned
}

\let\lendsplit@old=\lendsplit@
\def\lendsplit@{%
  \global\setbox\z@\vbox{\hbox{\BEQN\vbox{\unvcopy\z@}\EEQN}}%
  \lendsplit@old%
}
\let\rendsplit@old=\rendsplit@
\def\rendsplit@{%
   \global\setbox\z@\vbox{\hbox{\BEQN\vbox{\unvcopy\z@}\EEQN}}%
  \rendsplit@old%
}

% Mark the equation tag with DVISVGM specials
\let\tagform@old=\tagform@
\def\tagform@#1{\vbox{\special{dvisvgm:raw<!-- BVLBL: "{?y}" -->{?nl}}\hbox{\BLBL\tagform@old{#1}\ELBL}\special{dvisvgm:raw<!-- EVLBL: "{?y}" -->{?nl}{?nl}}}}

\let\maketag@@@old=\maketag@@@
\def\maketag@@@#1{\vbox{\special{dvisvgm:raw<!-- BVLBL: "{?y}" -->{?nl}}\hbox{\BLBL\maketag@@@old{#1}\ELBL}\special{dvisvgm:raw<!-- EVLBL: "{?y}" -->{?nl}{?nl}}}}

\def\irelop{\special{dvisvgm:raw<!-- irelop -->{?nl}}}
\def\ibiop{\special{dvisvgm:raw<!-- ibiop -->{?nl}}}
\def\cond{\special{dvisvgm:raw<!-- Condition -->{?nl}}}

\let\epsfig@old=\epsfig
\def\epsfig#1{%
  \epsfig@old{scale=1.36,#1}%
}

\makeatother

\setcounter{MaxMatrixCols}{40}

\let\thejournal\relax

\def\addedcdot{{\color{blue}\cdot}}

\begin{document}
  \begin{gather}\begin{gathered}{E}_{\varepsilon }\dot{x}\left(\vrule height 7.79312pt depth 0.15717pt width 0ptt\vrule height 7.79312pt depth 0.15717pt width 0pt\right)=Ax\left(\vrule height 7.79312pt depth 0.15717pt width 0ptt\vrule height 7.79312pt depth 0.15717pt width 0pt\right)\mathbin{+}B\varphi \left(\vrule height 5.93326pt depth 3.39229pt width 0pty\vrule height 5.93326pt depth 3.39229pt width 0pt\right)\mathbin{+}{B}_{u}u\left(\vrule height 7.79312pt depth 0.15717pt width 0ptt\vrule height 7.79312pt depth 0.15717pt width 0pt\right),\label{EEq1}\end{gathered}\tag*{$\text{(1)}$}\\[5pt]\begin{gathered}y\left(\vrule height 7.79312pt depth 0.15717pt width 0ptt\vrule height 7.79312pt depth 0.15717pt width 0pt\right)=Cx\left(\vrule height 7.79312pt depth 0.15717pt width 0ptt\vrule height 7.79312pt depth 0.15717pt width 0pt\right),\label{EEq2}\end{gathered}\tag*{$\text{(2)}$}\end{gather}
   \end{document} 

这是我的 {tc} 类文件示例

\NeedsTeXFormat{LaTeX2e}[1996/12/01]

\ProvidesClass{tc}[2000/01/01v1.0]
\newif\ifcomments\commentsfalse
\newif\ifeqtypes\eqtypesfalse
\newif\ifshowkeys\showkeysfalse
\newif\iffinal\finalfalse
\newif\if@advance\@advancefalse
\newif\if@proofs\@proofsfalse
\newif\ifmega\megafalse
\newif\ifeditorial\editorialfalse
\newif\ifscientifica\scientificafalse
\newif\iftswj\tswjfalse
\newif\iftswj\tswjfalse
\newif\ifcpis\cpisfalse
\newif\ifretraction\retractionfalse
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{revtex4-1}}
\DeclareOption{comments}{\commentstrue}
\DeclareOption{eqtypes}{\eqtypestrue}
\DeclareOption{showkeys}{\showkeystrue}
\DeclareOption{final}{\finaltrue}
\DeclareOption{advance}{\@advancetrue\finaltrue}
\DeclareOption{proofs}{\@proofstrue}
\DeclareOption{scientifica}{\scientificatrue}
\DeclareOption{tswj}{\tswjtrue}
\DeclareOption{editorial}{\editorialtrue}
\DeclareOption{cpis}{\cpistrue}
\DeclareOption{retraction}{\retractiontrue}

\ProcessOptions\relax
\LoadClass[twocolumn,twoside,nobalancelastpage,secnumarabic]{revtex4-1}

%%%%%%%%%%%%%%%%%fonts%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[onlytext,lf]{minionpro}
\usepackage{etoolbox}


\usepackage[amssymb,withamsmath,extraops]{minionmath}
\usepackage{amsmath}
\usepackage{minionamsmath}
\usepackage{amsthm}

\usepackage{cancel}
\usepackage{mathdots}

%\usepackage{amsmath}
%\usepackage{amsthm}
%\usepackage{minionmath}
%\usepackage{minionamsmath}

\usepackage{fancyhdr}
\usepackage{color}
\usepackage{ifthen}

\usepackage[raggedright]{subfigure}
\usepackage{graphicx}
\usepackage{epsfig}

\usepackage{array,multirow,framed}
\usepackage{threeparttable}
\usepackage{rotating}

\iffinal
  \usepackage{hyperxmp} % For PDF/A XMP metadata
  \PassOptionsToPackage{pdfa}{hyperref}
\fi
\usepackage[pdfusetitle]{hyperref}
\usepackage{hypernat}

%% BEGIN PDF/A PATCHS
%%
\iffinal
\forcsvlist{\listadd\my@metakeys}{Author, Title, Subject}
\let\old@pdf@addtoks=\pdf@addtoks
\def\pdf@addtoks#1#2{%
  \ifstrequal{#2}{F}{%
    % Very very very ugly hack to force setting annotation flags
    % to print, nozoom, norotate to make distiller happy when
    % creating pdf/a files.
    \old@pdf@addtoks{28}{#2}%
  }{%
    \ifstrequal{#2}{Color}{%
      % Another very very ugly hack to make sure that no url colors are
      % defined when hidelinks=true, otherwise the resulting PDF will
      % not validate when using CMYK color space.
      \ifHy@colorlinks%
        \old@pdf@addtoks{#1}{#2}%
      \fi%
    }{%
      \ifinlist{#2}{\my@metakeys}{%
        % We don't want to output some metadata keys at all, not even leave
        % them empty, so that Preflight does not complain about mismatch
        % between pdfinfo and XMP metadata.
      }{%
        \old@pdf@addtoks{#1}{#2}%
      }%
    }%
  }%
}
\fi
%%
%% END PDF/A PATCHES


\usepackage{mleftright}
\usepackage{tabularx}

%\usepackage{undertilde}
%\usepackage[single]{accents}

%\ifeqtypes
%\usepackage{resizegather}
%\fi

%%%%%%%%%%%%%%%%%Equation breaking%%%%%%%%%%%%%%%%%%%%%%%

\def\addedcdot{\cdot}

\usepackage{resizemath}

%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%% page dimisions%%%%%

%\special{papersize=602.3pt,11in}
\paperwidth 602.3pt
\paperheight 11in

\parindent 1.5em
\textwidth 500pt
\parskip 0pt

%\columnsep 1.5pc
%\topmargin -5pc
\columnsep 18pt
\topmargin -42pt

\setlength{\oddsidemargin}{-21.5pt}
\setlength{\evensidemargin}{-21.5pt}

%%%%%%%%%%%%%Commands%%%%%%%%%%%%%%

\frenchspacing
\widowpenalty=10000             % No widow line at bottom of page
\displaywidowpenalty=10000      % Same for displayed text
\clubpenalty=10000              % No orphan at top of page
\hyphenpenalty3000
\lefthyphenmin3
\righthyphenmin3
\brokenpenalty 10000

\newcommand{\etal}{et al}
\newcommand{\un}[1]{\,\mbox{#1}}
\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}
\newcommand{\bfchem}[1]{\ensuremath{\mathbf{#1}}}
\setlength{\overfullrule}{20pt}


%%%%%%%%%%%%%%eqtypes%%%%%%%%%%%%%%%%%
\newcommand{\eqcomment}[1]{%                
%\AtEndDocument{ 
%\ifeqtypes
%  \newpage 
%    \onecolumngrid
%    \parindent=-30pt
%    \leftskip=0pt
%    \rightskip=0pt
%    \parskip=12pt
%    \fontsize{12pt}{13pt}\sffamily\selectfont
%    \begin{center}
%      Unknown Equation's Types
%    \end{center}
%    \par
%    \vspace*{5pt}
%         #1
%    \vspace*{4pt}
%  \fi
%}                    
} 

\newcommand{\eqtype}[1]{%
  \unskip
  \ifeqtypes
    \setlength{\marginparwidth}{30pt}
    \marginpar{\framebox{#1}}% 
  \fi
}          
\newcommand{\shrink}[1]{%
  \unskip
  \ifeqtypes
    \setlength{\marginparwidth}{40pt}
    \marginpar{\framebox{#1}}% 
  \fi
} 

因此,请帮助我解决这个问题。

提前致谢

相关内容