0

I am trying to apply specific margins for few pages but it applies to all the pages. I have tried few solutions on stack tex, but none worked for me.

For the first 3 pages I don't want the margins and should act as default (by default I mean when I comment the \usepackage[left=3.5cm,top=2.5cm,right=1.25cm,bottom=1.25cm]{geometry} line and the result it shows). But for the other section pages the margin changes should be applied.

Can you please help me out here? Thank you.

img-1 img-2

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{fancybox}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{mwe}
\linespread{1.5}

\usepackage[left=3.5cm,top=2.5cm,right=1.25cm,bottom=1.25cm]{geometry}

\begin{document}

\begin{center}
    
    \begin{tikzpicture}[remember picture,overlay]
        \draw[black,line width=2pt] ([xshift=-1.5cm,yshift=-1.5cm]current page.north east)
        coordinate (A)--([xshift=1.5cm,yshift=-1.5cm]current page.north west)
        coordinate(B)--([xshift=1.5cm,yshift=1.5cm]current page.south west)
        coordinate (C)--([xshift=-1.5cm,yshift=1.5cm]current page.south east)
        coordinate(D)--cycle;
    \end{tikzpicture}

    \thispagestyle{empty}
    Title
    
    Subtitle
    \begin{figure}[h]
        \centering
        \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
    \end{figure}
    
    {\large \textbf{Project Name}} \\
    
    {\normalsize On} \\
    
    {\large \textbf{Project Title}} \\
    \textit{subtext} \\
    {\large \textbf{Degree}} \\
    {\normalsize \textbf{In}} \\
    {\large \textbf{Degree Title}} \\
    {\normalsize \textbf{Submitted by}} \\
    {\normalsize Name} \\
    {\normalsize \textbf{Under}} \\
    Name \\
    {\normalsize \textbf{Under}} \\
    Name \\
    SCHOOL name \\
    Address. \\
    Year
\end{center}

\newpage
    \vspace*{-30pt}
    \begin{tikzpicture}[remember picture,overlay]
        \draw[black,line width=3pt] ([xshift=-1cm,yshift=-1cm]current page.north east)
        coordinate (A)--([xshift=1cm,yshift=-1cm]current page.north west)
        coordinate(B)--([xshift=1cm,yshift=1cm]current page.south west)
        coordinate (C)--([xshift=-1cm,yshift=1cm]current page.south east)
        coordinate(D)--cycle;
    \end{tikzpicture}
    \begin{center}
    \thispagestyle{empty}
        \thispagestyle{empty}
    Title
    
    Subtitle
        \begin{figure}[H]
            \centering
            \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
        \end{figure}
        {\large INST NAME} \\ [10pt]
        {\LARGE \textbf{\textcolor{black}{TITLE}}}
    \end{center}

\newpage
\tableofcontents

\cleardoublepage
\pagenumbering{arabic}
\newpage
\section{Intro}
\lipsum[2-4]

\newpage
\section{Title1}
\lipsum[1-2]

\newpage
\section{Title2}
\lipsum[1-2]

\end{document}

2 Answers 2

1

One way is to load the package geometry without options. It will load with default margins for a4 paper.

Then use \newgeometry{left=1.5cm,top=2.5cm,right=1.5cm,bottom=1.25cm} before the title pages and finally issue\restoregeometry to go back to the initial conditions.

a

\documentclass[12pt,a4paper]{article}

\usepackage{fancybox}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{mwe}
\linespread{1.5}


\usepackage{geometry} % changed <<<<<<<<<<<<<<<<<<<<<<<

\begin{document}
    
    \newgeometry{left=1.5cm,top=2.5cm,right=1.5cm,bottom=1.25cm}% added <<<<<<<<<
    
    \begin{center}
    
        \begin{tikzpicture}[remember picture,overlay]
            \draw[black,line width=2pt] ([xshift=-1.5cm,yshift=-1.5cm]current page.north east)
            coordinate (A)--([xshift=1.5cm,yshift=-1.5cm]current page.north west)
            coordinate(B)--([xshift=1.5cm,yshift=1.5cm]current page.south west)
            coordinate (C)--([xshift=-1.5cm,yshift=1.5cm]current page.south east)
            coordinate(D)--cycle;
        \end{tikzpicture}
        
        \thispagestyle{empty}
        Title
        
        Subtitle
        
        \begin{figure}[h]
            \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
        \end{figure}
        
        {\large \textbf{Project Name}} \\
        
        {\normalsize On} \\
        
        {\large \textbf{Project Title}} \\
        \textit{subtext} \\
        {\large \textbf{Degree}} \\
        {\normalsize \textbf{In}} \\
        {\large \textbf{Degree Title}} \\
        {\normalsize \textbf{Submitted by}} \\
        {\normalsize Name} \\
        {\normalsize \textbf{Under}} \\
        Name \\
        {\normalsize \textbf{Under}} \\
        Name \\
        SCHOOL name \\
        Address. \\
        Year
    \end{center}
    
    \newpage

    \begin{center}
        \begin{tikzpicture}[remember picture,overlay]
            \draw[black,line width=2pt] ([xshift=-1.5cm,yshift=-1.5cm]current page.north east)
            coordinate (A)--([xshift=1.5cm,yshift=-1.5cm]current page.north west)
            coordinate(B)--([xshift=1.5cm,yshift=1.5cm]current page.south west)
            coordinate (C)--([xshift=-1.5cm,yshift=1.5cm]current page.south east)
            coordinate(D)--cycle;
        \end{tikzpicture}

        \thispagestyle{empty}
        Title
        
        Subtitle
        
        \begin{figure}[h]
            \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
        \end{figure}
%       {\large INST NAME} \\ [10pt]
        {\LARGE \textbf{\textcolor{black}{TITLE}}}
    \end{center}
    
    \restoregeometry % added <<<<<<<<<<<<<<<<<<<<<
    
    \tableofcontents
    
    \cleardoublepage
    \pagenumbering{arabic}
    \newpage
    \section{Intro}
    \lipsum[2-4]
    
    \newpage
    \section{Title1}
    \lipsum[1-2]
    
    \newpage
    \section{Title2}
    \lipsum[1-2]
    
\end{document}
0

If load geometry package without any options. The margin will still set to the default value according to the geometry package. To complete go back to the article class default margin settings. Use pass option in \usepackage[pass]{geometry}. This will disable all the geometry settings and the default margin setting in article class will be used. And then new margin could be set after table of contents page been printed out using \newgeometry{left=3.5cm,top=2.5cm,right=1.25cm,bottom=1.25cm}.

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{fancybox}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{mwe}
\linespread{1.5}

\usepackage[pass]{geometry}

\begin{document}
\begin{center}
    
    \begin{tikzpicture}[remember picture,overlay]
        \draw[black,line width=2pt] ([xshift=-1.5cm,yshift=-1.5cm]current page.north east)
        coordinate (A)--([xshift=1.5cm,yshift=-1.5cm]current page.north west)
        coordinate(B)--([xshift=1.5cm,yshift=1.5cm]current page.south west)
        coordinate (C)--([xshift=-1.5cm,yshift=1.5cm]current page.south east)
        coordinate(D)--cycle;
    \end{tikzpicture}

    \thispagestyle{empty}
    Title
    
    Subtitle
    \begin{figure}[h]
        \centering
        \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
    \end{figure}
    
    {\large \textbf{Project Name}} \\
    
    {\normalsize On} \\
    
    {\large \textbf{Project Title}} \\
    \textit{subtext} \\
    {\large \textbf{Degree}} \\
    {\normalsize \textbf{In}} \\
    {\large \textbf{Degree Title}} \\
    {\normalsize \textbf{Submitted by}} \\
    {\normalsize Name} \\
    {\normalsize \textbf{Under}} \\
    Name \\
    {\normalsize \textbf{Under}} \\
    Name \\
    SCHOOL name \\
    Address. \\
    Year
\end{center}

\newpage
    \vspace*{-30pt}
    \begin{tikzpicture}[remember picture,overlay]
        \draw[black,line width=3pt] ([xshift=-1cm,yshift=-1cm]current page.north east)
        coordinate (A)--([xshift=1cm,yshift=-1cm]current page.north west)
        coordinate(B)--([xshift=1cm,yshift=1cm]current page.south west)
        coordinate (C)--([xshift=-1cm,yshift=1cm]current page.south east)
        coordinate(D)--cycle;
    \end{tikzpicture}
    \begin{center}
    \thispagestyle{empty}
        \thispagestyle{empty}
    Title
    
    Subtitle
        \begin{figure}[H]
            \centering
            \includegraphics[height=0.4\textwidth,width=1\textwidth]{example-image-a}
        \end{figure}
        {\large INST NAME} \\ [10pt]
        {\LARGE \textbf{\textcolor{black}{TITLE}}}
    \end{center}

\newpage
\newgeometry{left=3.5cm,top=2.5cm,right=1.25cm,bottom=1.25cm}
\tableofcontents

\cleardoublepage
\pagenumbering{arabic}
\newpage
\section{Intro}
\lipsum[2-4]

\newpage
\section{Title1}
\lipsum[1-2]

\newpage
\section{Title2}
\lipsum[1-2]

\end{document}

enter image description here enter image description here

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.