LyXEquation numbers are showing in the LEFT instead of RIGHT

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
maqtanim
Posts: 1
Joined: Tue Feb 08, 2011 2:41 am

Equation numbers are showing in the LEFT instead of RIGHT

Post by maqtanim »

I've downloaded the thesis template of UNSW. Every thing is fine so far except the problem with numbered equation. The numbers are shown on the left side of the equation instead of the right side. I mean if I write a numbered equation, in the preview the number is shown up on the left side of the equation instead of right side. I mean I want the equations something like the following:

a+b=e-d (1.1)
v-u=j*y (1.2)

But in the pdf/ps preview of UNSW template, it is shown as below:

(1.1) a+b=e-d
(1.2) v-u=j*y

Can anyone please help me to show equation number in the right side? The .layout file is as following:

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[amsbook]{UNSW Thesis}
# UNSW Thesis textclass
# Based on the "book (AMS)" textclass by David L. Johnson and others.
# Author : Mark Reid <mark@threewordslong.com>
#
# This is by no means the best way to set up a LyX layout - I probably should have
# defined a .cls file that was an extension of amsbook and put most of the markup
# in that. However, doing things this way means a user of this layout only need
# install this file and not worry about installing a new .cls file.
#
# Much of the code in the preamble is borrowed from:
#   http://www.ctan.org/tex-archive/macros/latex/contrib/adfathesis/adfathesis.dtx

# General textclass parameters
# Description          "thesis"
Columns			1
Sides			2
PageStyle		Headers
MaxCounter		Counter_Chapter

ClassOptions
  FontSize   8|9|10|11|12
End  

# Standard style definition
Style Standard
  Margin  		Static
  LatexType 	Paragraph
  LatexName 	dummy
  ParIndent		MM
  ParSkip 		0.4
  Align 		Block
  AlignPossible Block, Left, Right, Center
  LabelType 	No_Label
End

############### Title Page.
Style Title
  LatexType		Command
  LatexName		title
  InTitle		1
  NewLine		1
End

Style Author
  LatexType		Command
  LatexName		author
  InTitle		1
End

############### Sections.

Input stdsections.inc

# Redefine some of the section styles.
Style Section
  Align			Center
  AlignPossible		Block, Center, Left

  # standard font definition
  Font
    Series 		Medium
    Shape		Smallcaps
    Size		Large
  EndFont
End

# Subsection-numbered style definition
Style Subsection
  # standard font definition
  Font
    Series 		Bold
    Size		Normal
  EndFont
End

# Subsubsection-numbered style definition
Style Subsubsection
  # standard font definition
  Font
    Shape 		Italic
    Size		Normal
  EndFont
End

# then define the unumbered sections, based on the numbered ones.
Input stdstarsections.inc

Input lyxmacros.inc
NoStyle Address

Input amsdefs.inc
 
Input stdlayouts.inc
NoStyle Verse    # Although mathematicians tend to be poets at times, 
                 # we don't need this.

Input stdlists.inc
Input stdfloats.inc

############# Algorithm 2e Style
Float
  Type                  algorithm2e
  GuiName               "Algorithm 2e"
  Placement             tbp
  Extension             loa
  NumberWithin          none
  Style                 ruled
  ListName              "List of Algorithms"
  LaTeXBuiltin          false
End

Input stdcounters.inc

############### Verbatim environment using fancyvrb for code
Style Code
  LatexType		Environment
  LatexName		Verbatim
  LatexParam	"[fontsize=\smaller]" #,xleftmargin=2em,xrightmargin=2em]"
  PassThru		1
  NewLine		0
  FreeSpacing   1
  LeftMargin	MMM
  RightMargin   MMM
  ParSkip		0.0
  TopSep		1.0
  BottomSep		1.0
  Align			Left
  AlignPossible	Left

  # standard font definition
  Font
    Family		Typewriter
  EndFont

  Preamble
\usepackage{fancyvrb}
  EndPreamble

End

########### Document Preamble
# Defines margins, etc
Preamble
  \numberwithin{section}{chapter}
  \theoremstyle{plain}    
  \newtheorem{thm}{Theorem}[chapter]
  \numberwithin{figure}{chapter} %% Comment out for sequentially-numbered
  \numberwithin{table}{chapter}  %% Comment out for sequentially-numbered

\newcommand{\setpagesize}{%
    \setlength{\oddsidemargin}  {1.5cm}
    \setlength{\evensidemargin} {-0.5cm}    % was 0cm
    \setlength{\marginparwidth} {40\p@}
    \setlength{\marginparsep}   {10\p@}     % was 0pt
    \setlength{\topmargin}      {-0.6cm}    % was 0cm
    \setlength{\headheight}     {15\p@}     % was 12pt
    \setlength{\headsep}        {0.5cm}
    \setlength{\textwidth}      {14.1cm}    % was 15cm
    \setlength\@tempdima{\paperheight}
    \addtolength\@tempdima{-35mm}  % top margin
    \addtolength\@tempdima{-25mm}  % bottom margin
    \divide\@tempdima\baselineskip
    \@tempcnta=\@tempdima
    \setlength\textheight{\@tempcnta\baselineskip}
    \addtolength\textheight{\topskip}
    \setlength{\topskip}{1\topskip \@plus 1\baselineskip}
    \setlength{\parskip}{0pt}
    \raggedbottom
}

%-----------------------------------------------------------------------
%  Reduce widow/orphan problems, mainly from a posting from Donald
%  Arsenau on comp.text.tex, 24 Sep 1995.
%  Updated to follow comments from Michael Downes on comp.text.tex,
%  31 Aug 1998.
%-----------------------------------------------------------------------
\doublehyphendemerits=10000     % No consecutive line hyphens.
\brokenpenalty=4991             % Reduce broken words across columns/pages.
\widowpenalty=9999              % Almost no widows at bottom of page.
\clubpenalty=9996               % Almost no orphans at top of page.
\interfootnotelinepenalty=9999  % Almost never break footnotes.
\predisplaypenalty=10000        % Default value
\postdisplaypenalty=1549        % Few breaks between display and widows
\displaywidowpenalty=1602       % At least as high as \postdisplaypenalty

%-----------------------------------------------------------------------
% Change float placement parameters to reduce problems.  Based on
% values posted by Donald Arsenau on comp.text.tex at various times.
% See in particular 17th Nov 1997.
%-----------------------------------------------------------------------
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}

%-----------------------------------------------------------------------
% Re-define \cleardoublepage as recommended by Piet van Oostrum in the
% documentation for fancyhdr.sty page 15.  This is to avoid blank pages
% having headers or footers.
%-----------------------------------------------------------------------
\renewcommand{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
   \thispagestyle{empty}
   \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

%-----------------------------------------------------------------------
% Number figures, tables and equations by chapter.  Re-define footnotes
% and minipage footnotes to be single spaced.  Make new macros needed
% for thesis definitions.
%-----------------------------------------------------------------------
\renewcommand{\thefigure}{\thechapter.\@arabic\c@figure}
\renewcommand{\thetable}{\thechapter.\@arabic\c@table}
\renewcommand{\theequation}{\thechapter.\@arabic\c@equation}

% Re-define \@footnotetext and \@mpfootnotetext to use single spacing
% rather than the space-and-a-half that is the default elsewhere.

\renewcommand{\@footnotetext}[1]{\insert\footins{%
    \linespread{1}\normalfont\footnotesize%
    \interlinepenalty\interfootnotelinepenalty
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \color@endgroup}}

\renewcommand{\@mpfootnotetext}[1]{%
  \global\setbox\@mpfootins\vbox{%
    \unvbox \@mpfootins
    \linespread{1}\normalfont\footnotesize%
    \hsize\columnwidth
    \@parboxrestore
    \protected@edef\@currentlabel{%
      \csname p@mpfootnote\endcsname\@thefnmark}%
    \color@begingroup
      \@makefntext{%
       \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
   \color@endgroup}}

\renewcommand{\bibname}{References}

\renewcommand{\title}[1]{\gdef\@title{#1}}
\renewcommand{\author}[1]{\gdef\@author{#1}}
\newcommand{\school}[1]{\gdef\@school{#1}}
\newcommand{\degreetype}[1]{\gdef\@degreetype{#1}}
\newcommand{\submitdate}[1]{\gdef\@submitdate{#1}}

\renewcommand{\@title}{}
\renewcommand{\@author}{}
\newcommand{\@school}{Computer Science and Engineering}
\newcommand{\@degreetype}{Doctor of Philosophy}
\newcommand{\@university}{The University of New South Wales}
\newcommand{\@submitdate}{\ifcase\the\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\the\year}
\ifnum\month=12
    \@tempcnta=\year \advance\@tempcnta by 1
    \edef\@copyrightyear{\number\the\@tempcnta}
\else
    \newcommand{\@copyrightyear}{\number\the\year}

%-----------------------------------------------------------------------
% Title page definition.
%-----------------------------------------------------------------------
\newcommand{\titlep}{%
        \thispagestyle{empty}%
        \begin{titlepage}
        \null\vskip2.5cm%
        \begin{center}
                {\rmfamily\Large\expandafter{\@title}}
        \end{center}
        \vskip1cm
        \begin{center}
                {\rmfamily\normalsize By \\ \expandafter{\@author}}
        \end{center}
        \vfill
        \begin{center}
                \textsc{A thesis submitted for the degree of \\
                \expandafter{\@degreetype}}
        \end{center}
        \vfill
        \vskip1cm
\begin{center}
\includegraphics[width=4cm]{unswcrest.pdf}
\end{center}
        \vskip1cm
        \begin{center}
                {\rmfamily\normalsize \expandafter{\@school},\\
                \expandafter{\@university}.}
                \vskip1cm
                {\rmfamily\normalsize \@submitdate}\\
        \end{center}
        \vskip1cm
        \end{titlepage}
        \newpage}

%-----------------------------------------------------------------------
% Redefine \maketitle so as to make a UNSW suitable title
%-----------------------------------------------------------------------
\renewcommand{\maketitle}{%
        \thispagestyle{empty}%
        \newpage%
        \titlep
        \setpagesize
        \raggedbottom
    }
EndPreamble


BTW... I am a newbie to the Lyx (in fact only a week old). :P

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

dschneiderch
Posts: 22
Joined: Thu Mar 31, 2011 10:41 pm

Re: Equation numbers are showing in the LEFT instead of RIGH

Post by dschneiderch »

This happened to me a few weeks ago and I was able to fix it by changing the equation type so try switching between display, display AMS etc.
Post Reply