1

Forgive my poor language and my unprofessional question but i need to understand more.

I wrote 2 definitions for a commands, the first command write the current X position and Y position BEFORE the equation box in a comment and the second command write the current X position and Y position AFTER the equation box in another comment, what i noticed after producing PDF that the equations with multi labels were not aligned at '=' sign and by removing the 2 commands, the equations aligned correctly at '=' sign.

Here is a snap form my Commands

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

and i am using these commands as the following:

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

so, when i removed the commands \BEQN, \EEQN and \hbox with the outer \vbox from the previous part, equations aligned correctly and the previous part be as the following:

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

Here is my full code sample

    \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} 

and this is my {tc} class file sample

\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
} 

So, Please help me regarding this issue.

Thanks in Advance

12
  • 1
    (1) Welcome, (2) please post a full minimal example, that makes it a lot easier to figure out what exactly it is you are trying to do.
    – daleif
    Oct 13, 2015 at 9:19
  • Thank you for your response @daleif. what i am trying to do is to measure the width and height of the equation exactly by measuring the start and the end of the equation in 2 dimensions X and Y then in another tool i get this information from the output comments and convert the equation into SVG. I made an edit to my question and wrote a snap form the equation. Oct 13, 2015 at 9:26
  • 1
    That is still not very useful, we cannot compile any of that code without having to add stuff to it. Is this LaTeX, plain TeX ....
    – daleif
    Oct 13, 2015 at 9:27
  • This is LaTeX project and i have cls file but i cannot post it here because of confidentially. sorry i cannot do more, what i need to know is the behavior of LaTeX in the both cases and is these commands affect the LaTeX behavior? Oct 13, 2015 at 9:32
  • 1
    @MohamedSayed --- You don't need to share your class file, just delete irrelevant material to reduce it down to a short code that reproduces the problem. There are some real experts on this site, but none of them is psychic, as far as I know. Without sufficient information, there is a risk that your question will be closed. Oct 13, 2015 at 9:46

0

Browse other questions tagged .