0

I have using own custom LaTeX Class file and how to change the oddside and evenside margin in the new page to End of the document. I'm not possible to use \newgeometry options because more development is used my own LaTeX class file. I have tried Odd-even margin, If Then Else for odd page/even page but unable to get my requirement.

My Requirement is if oddpage need to give \leftskip50pt or \leftmargin50pt and if evenpage need to give \leftskip10pt or \leftmargin10pt. I have using XeLaTeX packages are tikz, pgz, tcolorbox etc.

My MWE is:

\documentclass{article}
\usepackage[textwidth=450pt,textheight=600pt,left=50mm,right=50mm]{geometry}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\usepackage{caption}
\usepackage[a3]{crop}
\voffset=60pt
\hoffset=60pt
\makeatletter
\renewenvironment{quote}
               {\list{}{\leftmargin50pt\rightmargin60pt}%
                \item\relax}
               {\endlist}
\makeatother

\newcommand{\mygraphics}[3][]{%
  \tcbincludegraphics[nobeforeafter,
    blanker,hbox,
    minipage boxed title*=-6mm,
    title={\captionsetup{skip=0pt}\captionof{figure}    {#3}},
    attach boxed title to bottom center,
    boxed title style={enhanced,size=title,sharp corners,
      boxrule=0pt,frame hidden,colback=green!50!black!    25},
    #1]{#2}%
}

\newsavebox\mysavebox

\newenvironment{textbyfigure}[1]{%
  \sbox{\mysavebox}{#1}%
  \begin{tcolorbox}[blanker,
    beforeafter skip=5pt,
    sidebyside,sidebyside gap=5mm,
    sidebyside align=top,
    righthand width=\wd\mysavebox,]%
}{%
  \tcblower%
  \raisebox{\the\dimexpr-\ht\mysavebox-\dp\mysavebox+\baselineskip/2\relax}    {\usebox{\mysavebox}}%
  \end{tcolorbox}
}
\crop
\begin{document}

\lipsum[1-2]

\begin{textbyfigure}{
  \mygraphics{drawer.png}
    {The Roman numerals on this stone show the distance     to the next village.}}
Throughout the ages and in different countries, number     systems were developed
and used to help people count and communicate with     numbers. From the ancient
Egyptians to the modern day, different systems have     used pictures and symbols to
represent whole numbers. Some of the well-known     number systems are the Egyptian,
Babylonian, Roman, modern Chinese and the Hindu-    Arabic or decimal system.
\end{textbyfigure}

\lipsum[2]

\newpage
\begin{quote}
\lipsum[3-15]
\end{quote}

\end{document}
Balaji
  • 2,282
  • That's not an MWE. Please post an example which will compile. I don't understand what you mean by switching in the middle of the page. – cfr Feb 07 '15 at 16:08
  • Perhaps ypu should say what your intended outcome is. it doesn't make sense to change \oddsidemargin mid page as it is used in setting up the page head and foot. However you can simply change the visual margin by using a list environment, see the definition of quote in article.cls which increases left and right margin, but other variants are possible – David Carlisle Feb 07 '15 at 16:08
  • @cfr: I have required newpage and not a middle of the page. For Example, Page No. 1 and 2 leftmargin is 50pt and rightmargin is 50pt and Page 3 onwards leftmargin need 75pt and rightmargin is 85pt. – Balaji Feb 07 '15 at 17:21
  • @David: I have check quote environment but it's changing globally same size only. But my requirement is Page No 3 leftmargin should be 50pt and Page No 4 leftmargin should be 85pt. How to achieve this? I have updated my question. – Balaji Feb 07 '15 at 17:28
  • It's not really possible as text is typeset before tex decides which page it will be on. the page breaker can move an entire page left or right (hence oddsidemargin and evensidemargin) but you can not do that mid page – David Carlisle Feb 07 '15 at 17:50
  • @David: Thanks for your info. and one small doubt, using \newgeomentry we can able to change oddsidemargin and evensidemargin when starting new page in the document. – Balaji Feb 07 '15 at 17:56
  • yes but that is at a forced page break the page break is forced for exactly that reason, you can not change mid page – David Carlisle Feb 07 '15 at 17:58
  • @David: My requirement is also the same. But i cann't use \newgeomentry options because my own LaTeX template is having some automation scripts. It's possible any other way? – Balaji Feb 07 '15 at 18:01
  • your stated requirement is to do it "in the middle of a page" which isn't possible, if that is not what you meant I suggest you edit the question – David Carlisle Feb 07 '15 at 18:08
  • @David: Updated my question. – Balaji Feb 07 '15 at 18:26

0 Answers0