1

I have two questions according to my Thesis. First, how do I switch margins automatically for every second pages, such as:

enter image description here enter image description here

Second how do I switch the page numbers and including different text every second pages?

enter image description here enter image description here

If anyone could help me by doing that, I would appreciate it!

Best regards

A. F.
  • 1,227
  • 1
  • 13
  • 21

1 Answers1

3

This is actually similar to the style I'm using in my thesis. I'm not sure I understood what you mean with "switch margins", but Latex should arrange the margins in a twoside document automatically. If you want to add further space, you can use the option bindingoffset of the geometry package (you only need to change the 0mm in the code below).

To change the footers (and headers) of the page I used the fancyhdr package; i redefined also the plain style to keep consistency throughout the document.

\documentclass[12pt,a4paper,twoside]{report}

% Page layout
\usepackage[bindingoffset=0mm]{geometry}

% Random text
\usepackage{lipsum}

% Page style
\usepackage{fancyhdr}

% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{\leftmark \ {\vrule height 13pt width 1pt}  \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \MakeUppercase{\chaptername}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 13pt width 1pt} \ \thepage}
\fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}

\begin{document}
\pagestyle{plain}
...pages in plain style...
\pagestyle{MyStyle}
\chapter{First chapter title}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\end{document}

One thing I noticed is that MyStyle is applied correctly only if there is a previous \pagestyle{plain}; I'm not sure of why this happens, but luckily there are always pages in plain style before the chapters (at least in my thesis), like table of contents, list of figure, etc.

MarcoG
  • 1,437
  • I will try working on that. Thank you so much. Is it possible, that I can see your thesis and your LaTeX-commands? I am using MinionPro. Thank you! – A. F. Jun 13 '15 at 15:46
  • If you want to see my page style you can look at this question I asked: http://tex.stackexchange.com/questions/250232/fancyhdr-does-not-apply-the-right-style. That is more or less the style I am using. Moreover, I only used titlesec to increase the blank space before the chapter title. – MarcoG Jun 14 '15 at 17:37
  • I have two questions @MarcoG. If I only want to keep the different in footnote. And if I want to use "article" instead of "report" how should I make the different? – A. F. Jun 16 '15 at 08:40
  • I'm sorry I didn't understand your first question. Regarding the second one, the documentclass{article} doesn't include chapters, therefore you can't use this style. You could add the section title redefing \rightmark in this way: \renewcommand{\sectionmark}[1]{\markright{\uppercase{##1}}{}} and changing the footer's style with \fancyfoot[RO]{\rightmark \ {\vrule height 13pt width 1pt} \thepage}. – MarcoG Jun 16 '15 at 08:53
  • Page 1 doesn't show "Introduction" or "Chapter One". Do you know why? And how do I increase/decrease the space between the page number and the "Introduction" or "Chapter One"? Finally how do I change the text format? Thank you! – A. F. Jun 16 '15 at 21:39
  • So it looks more like the attached photo above – A. F. Jun 16 '15 at 21:39
  • @A.F. You're welcome! The initial page of each chapter is in plain style by default; to modify it, you have to redifine this style (as I did). If you want to add "Chapter 1", for example, you only need \fancyfoot[LE]{\thepage \ {\vrule height 13pt width 1pt} \MakeUppercase{\chaptername}\ \thechapter} (in the plain style). To change the distance between the rule and the text, you could use \hspace{<distance>} between {\vrule...} and the text. Finally, to change the format, it is the same as changing the format inside the body of the document: e.g. \textbf{\leftmark}. – MarcoG Jun 17 '15 at 07:23
  • If I want to change size - I just put \small in before \MakeUppercase{\chaptername}? On my first page it don't show the chapter name or title of the chapter. How do I change that? Finally, if I have a chaptername like: "Study 3: What is the difference between X and X". Instead of putting the whole chaptername into page numbers, how do I only take a part of the, for instance: "Study 3"? – A. F. Jun 17 '15 at 08:13
  • @A.F. \small{\MakeUppercase{...}} works fine. By first page, do you mean the initial page of a chapter? If so, then you basically have to copy the code of MyStyle inside the plain redefinition (but in this way you will change all your plain pages). To remove a part of the chapter title, you could use \chapter[Short title]{Long title}, but you'll have Short title also in toc; to avoid this, you can write \chapter{Long title} \chaptermark{Short title} (http://tex.stackexchange.com/questions/6862/how-can-i-display-a-short-chapter-name-in-the-header-and-a-long-chapter-name-in-t) – MarcoG Jun 17 '15 at 08:35
  • Weird. It works fine here now as well. The chaptermark was exactly my missing point. On the first I can only see the page number. On every other pages I can see the page number and chaptername or chapter. I just want to know if it is possible to start seeing a page number and chaptername or chapter from the first page? If that makes sense. – A. F. Jun 17 '15 at 08:48
  • @A.F.You see only the page number and no text in every first page of chapters. That happens because plain style is applied, instead of MyStyle. If you copy the code inside \fancypagestyle{MyStyle}{...} in \fancypagestyle{plain}{...}, you'll get the same footer in every page. But usually this is not recommended, since in the initial pages you can see chapter's number and title easily, and the footer would be useless; moreover, you'll have many plain pages inside your document (first page of table of contents, etc), and changing this style will affect them all. – MarcoG Jun 17 '15 at 09:01
  • Your help has been amazing - I just still have one more questions about the footer. I have therefore created a new question, which I hope you could help me with! – A. F. Aug 15 '15 at 10:53
  • @A.F. You're welcome :-) ! I could not look at your question during the past days, but I saw that you got already an answer! – MarcoG Aug 17 '15 at 06:37
  • Hi MarcoG. I have tried cfr's solution, but it won't work together with your command. If I would like to make it possible to have chapter/chaptername in the first part. And only bibliography/bibliography and appendix/appendix in the footer in the last part - what should I edited? – A. F. Aug 17 '15 at 07:37