0
%
%---------------------------------------------------------------------------------------------------------- %
\documentclass{book} %
%---------------------------------------------------------------------------------------------------------- %
%
\usepackage[fleqn]{amsmath} %
\usepackage[explicit]{titlesec} %
\usepackage{titletoc} % 
\usepackage[many]{tcolorbox}
\usepackage[english]{babel} %
\usepackage{fancyhdr} %
\usepackage{xcolor,colortbl}
\usepackage[a4,frame,center]{crop} % a4=210mm x 297mm

\setlength{\unitlength}{1mm} %

\frontmatter

\paperwidth=170mm
\paperheight=240mm
\setlength{\textwidth}{132mm} %
\setlength{\oddsidemargin}{0mm} %
\setlength{\evensidemargin}{-12mm} %
\setlength{\headwidth}{\textwidth}

\setcounter{section}{1} % was 1
\setcounter{tocdepth}{2} % depth in contents lists
\setcounter{equation}{2}

\definecolor{DarkRed}{rgb}{0.45,0.00,0.00} % #880000
\definecolor{ThemeColour}{rgb}{0.40,0.00,0.40} % ThemeColour maroon
\definecolor{LightGrey}{rgb}{0.96,0.96,0.96}

\newcommand\Hrule{\noindent\color{ThemeColour}{\rule{\linewidth}{3pt}}} %
\newcommand\hseprule{\color{DarkRed}{\rule{\linewidth}{0.8pt}}} %

\titleformat{\chapter}[display]
{\color{ThemeColour}\bfseries\itshape\fontsize{30}{30}\selectfont}
{\Hrule\vspace*{6pt}\\ {\color{black}\,\chaptername\hspace{8pt}\normalfont\fontsize{42}{45}\selectfont{\thechapter}}}
{0pt}
{\bfseries\normalfont\fontsize{15}{18}\selectfont{#1} \\ \vspace*{-9pt}\Hrule} %
[\vspace{18pt}]
\titlespacing{\chapter}{0pt}{12pt}{6pt}[0pt] %
\renewcommand{\thechapter}{\arabic{chapter}} % make-up of the numbering

\tcbset{boxsep=5.4pt,height=18mm,boxrule=1.2pt,arc=3pt,outer arc=3.2pt,valign=center,width=\linewidth,
coltitle=white,colbacktitle=ThemeColour,after=\hfill,colframe=black,colback=LightGrey}

\newtcolorbox{sectionbox}[2][] % create sectionbox
{title={#2},fonttitle=\bfseries,#1}

\titleformat{\section} %
  {\normalfont\bfseries\itshape\fontsize{12}{14}\selectfont}
  {}{0pt}
{\begin{sectionbox}{\fontsize{14}{15}\selectfont{Section\hspace{5.4pt}\thetitle}}{\fontsize{12.8}{15}\selectfont{#1}}
\end{sectionbox}}
\titlespacing{\section}{0pt}{15pt}{6pt}[0pt] %
\renewcommand{\thesection}{\arabic{section}} % make-up of number


% ----------------------- ******* change the style of equation numbering ******* ----------------------------------- %

\makeatletter
\let\mytagform@=\tagform@ % set at 18mm from right - wish to vary this within document
%
\def\tagform@#1{\maketag@@@{\color{DarkRed}{[\hspace{0.5pt}#1\unskip\@@italiccorr\hspace{0.5pt}]}}\hspace{18mm}} % HERE
\renewcommand{\eqref}[1]{\textup{[\ref{#1}]}}
\makeatother

\renewcommand{\theequation}{\hspace{0.8pt}\thechapter\hspace{1.0pt}.\hspace{0.6pt}\arabic{equation}\hspace{0.8pt}} % 0.8pt

% ----------------------------------------- style of equation numbering -------------------------------------------- %

\begin{document}

\mainmatter

\chapter{Introduction to number and simple algebra}

\section{Discovering and manipulating counting numbers}

\setlength{\mathindent}{100pt} % Distance in from left
\begin{equation}
\dfrac{2\hspace{1.0pt}x+3}{4}=\dfrac{5-x}{3} \label{eqn:firstequation}
\end{equation}

\setlength{\mathindent}{130pt} % Distance in from left
\begin{equation}
\dfrac{2\hspace{1.0pt}x+3}{4}=\dfrac{5-x}{3} \label{eqn:secondequation}
\end{equation}

\end{document}
  • 2
    Please be more specific as to what you're trying to achieve. With only the information given in the title of your posting, a nearly unbounded number of possibilities comes to mind. – Mico Jun 8 '15 at 4:54
  • And add a MINIMAL working example. – Astrinus Jun 8 '15 at 6:34
  • Should I interpret the question as “how can I get equation numbers on the right for odd numbered pages and on the left for even numbered ones?” If this is the question, I'd like to tell you that such a setup is not used in the finest books. – egreg Jun 8 '15 at 7:29
  • To clarify: I want the numbers to always be on the right (of every page), but to vary the distance from the right to suit long and short equations. – keith77777 Jun 8 '15 at 11:00
  • Ah, you can use a \parbox or minipage (centered) to reduce the width of the equation (including the number). – John Kormylo Jun 8 '15 at 14:16
1

I'm not convinced this is a good idea:-)

But

enter image description here

%
%---------------------------------------------------------------------------------------------------------- %
\documentclass{book} %
%---------------------------------------------------------------------------------------------------------- %
%
\usepackage[fleqn]{amsmath} %
\usepackage[explicit]{titlesec} %
\usepackage{titletoc} % 
\usepackage[many]{tcolorbox}
\usepackage[english]{babel} %
\usepackage{fancyhdr} %
\usepackage{xcolor,colortbl}
\usepackage[a4,frame,center]{crop} % a4=210mm x 297mm

\setlength{\unitlength}{1mm} %

\frontmatter

\paperwidth=170mm
\paperheight=240mm
\setlength{\textwidth}{132mm} %
\setlength{\oddsidemargin}{0mm} %
\setlength{\evensidemargin}{-12mm} %
\setlength{\headwidth}{\textwidth}

\setcounter{section}{1} % was 1
\setcounter{tocdepth}{2} % depth in contents lists
\setcounter{equation}{2}

\definecolor{DarkRed}{rgb}{0.45,0.00,0.00} % #880000
\definecolor{ThemeColour}{rgb}{0.40,0.00,0.40} % ThemeColour maroon
\definecolor{LightGrey}{rgb}{0.96,0.96,0.96}

\newcommand\Hrule{\noindent\color{ThemeColour}{\rule{\linewidth}{3pt}}} %
\newcommand\hseprule{\color{DarkRed}{\rule{\linewidth}{0.8pt}}} %

\titleformat{\chapter}[display]
{\color{ThemeColour}\bfseries\itshape\fontsize{30}{30}\selectfont}
{\Hrule\vspace*{6pt}\\ {\color{black}\,\chaptername\hspace{8pt}\normalfont\fontsize{42}{45}\selectfont{\thechapter}}}
{0pt}
{\bfseries\normalfont\fontsize{15}{18}\selectfont{#1} \\ \vspace*{-9pt}\Hrule} %
[\vspace{18pt}]
\titlespacing{\chapter}{0pt}{12pt}{6pt}[0pt] %
\renewcommand{\thechapter}{\arabic{chapter}} % make-up of the numbering

\tcbset{boxsep=5.4pt,height=18mm,boxrule=1.2pt,arc=3pt,outer arc=3.2pt,valign=center,width=\linewidth,
coltitle=white,colbacktitle=ThemeColour,after=\hfill,colframe=black,colback=LightGrey}

\newtcolorbox{sectionbox}[2][] % create sectionbox
{title={#2},fonttitle=\bfseries,#1}

\titleformat{\section} %
  {\normalfont\bfseries\itshape\fontsize{12}{14}\selectfont}
  {}{0pt}
{\begin{sectionbox}{\fontsize{14}{15}\selectfont{Section\hspace{5.4pt}\thetitle}}{\fontsize{12.8}{15}\selectfont{#1}}
\end{sectionbox}}
\titlespacing{\section}{0pt}{15pt}{6pt}[0pt] %
\renewcommand{\thesection}{\arabic{section}} % make-up of number


% ----------------------- ******* change the style of equation numbering ******* ----------------------------------- %

\makeatletter
\let\mytagform@=\tagform@ % set at 18mm from right - wish to vary this within document
%
\def\tagform@#1{\maketag@@@{\color{DarkRed}{[\hspace{0.5pt}#1\unskip\@@italiccorr\hspace{0.5pt}]}}\hspace{18mm}} % HERE
\renewcommand{\eqref}[1]{\textup{[\ref{#1}]}}
\makeatother

\renewcommand{\theequation}{\hspace{0.8pt}\thechapter\hspace{1.0pt}.\hspace{0.6pt}\arabic{equation}\hspace{0.8pt}} % 0.8pt

% ----------------------------------------- style of equation numbering -------------------------------------------- %

\begin{document}

\mainmatter

\chapter{Introduction to number and simple algebra}

\section{Discovering and manipulating counting numbers}

\setlength{\mathindent}{100pt} % Distance in from left
\begin{equation}
\dfrac{2\hspace{1.0pt}x+3}{4}=\dfrac{5-x}{3} \label{eqn:firstequation}
\end{equation}

\setlength{\mathindent}{130pt} % Distance in from left
\begin{equation}
\dfrac{2\hspace{1.0pt}x+3}{4}=\dfrac{5-x}{3} \label{eqn:secondequation}
\end{equation}


\setlength{\mathindent}{130pt} % Distance in from left
{\addtolength{\hsize}{-20pt} % Distance in from right
\begin{equation}
\dfrac{2\hspace{1.0pt}x+3}{4}=\dfrac{5-x}{3} \label{eqn:secondequation}
\end{equation}}%

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.