Latex : Understand memoir pagestyle - latex

I have a sample of doc in latex and would like you to explain why this is not working as expected.
This is the code:
\documentclass{memoir}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{background}
\begin{document}
\SetBgContents{plain}
\pagestyle{plain}
\makeoddhead{plain}{}{}{header test}
\blinddocument
\clearpage
\blinddocument
\clearpage
\blinddocument
\clearpage
\end{document}
After compilation:
Indentation of the page changes from page to page
"header test" some time appears, sometime not
There are blank pages when I explicitly put "clearpage"
Can you please explain how to solve and make something stable ?
Thanks

Unless specified otherwise, the default option passed to memoir is to set the document in twoside mode. See p 5 of the memoir documentation under REMARKS:
Calling the class with no options is equivalent to:
\documentclass[letterpaper,10pt,twoside,onecolumn,openright,final]{memoir}
Under twoside, the odd and even pages are offset from the inner margin, or the gutter. This results in the differing "indentations" of the page.
\makeoddhead only sets the header for odd pages. Odd pages only occur every other page, leaving even page headers empty (the default for the plain page style).
\clearpage flushes all pending floats and starts a new page. There should be no blank page issued. However, with a call to \chapter, memoir actually issues \clearforchapter, which is similar to \cleartorecto or \cleardoublepage. This necessarily clears pages until an odd page is reached, ensuring that a chapter starts on a right.

Related

Page Numbers not showing correctly in latex document

I am very new to making documents in Latex and I need to write a report.
I have made a main.tex where in I call each chapter. I would like :
for the declaration, acknowledgement, lift of figures and list of tables to have roman page numbers
introduction and following chapters to have arabic numbers
I have browsed the previous posts and found a bit of code but somehow my page numbers do not show. Page number is visible only on the Title Page and I do not want the Title Page to have any number.
Here is the code I currently have:
\documentclass{Thesis}
\input{import_packages.tex}
\pagestyle{plain}
\pagenumbering{roman}
\begin{document}
\input{titlepage.tex}
\frontmatter
\input{Declaration.tex}
\input{Acknowledgement.tex}
\input{TableOfContents.tex}
\input{ListOfFigures.tex}
\input{ListOfTables.tex}
\mainmatter
\input{Introduction.tex}
\input{ProblemDescription.tex}
\input{BackgroundResearch.tex}
\input{DataPreprocessingAndPreparation.tex}
\input{AlgorithmAndApproach.tex}
\input{Implementation.tex}
\input{ExperimentalAndStatisticalResults.tex}
\input{Conclusion.tex}
\input{FutureScopeofWork.tex}
\end{document}
I would really appreciate if someone could help me with this. Thank you.

LATEX: delete the number of page from the backmatter

im tring to delete the page number from my \backmatter sequence. I've succeded to do this, writing this code:
\begin{document}
.
.
.
\backmatter
\begingroup
\makeatletter
\let\ps#plain\ps#empty
\addcontentsline{toc}{chapter}{Allegati}
\input{Allegati}
\input{Bibliografia}
\listoffigures
\listoftables
\listof{grafico}{Elenco dei grafici}
\endgroup
\end{document}
But, I don't know why, the last page of my document still have his number. In the code above the last page is a graphic list, but if I change the order of my sequence, for example putting the bibliography in the last position, the this element will present the page number. I'm writing this document using the book class.
Someone can help me?
thanks
As you did not provide a MWE (Minimal Working Example) I can just guess what your document's preamble contains.
Have a look at this code please:
\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{plain}{
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{}
}
\begin{document}
text
\newpage
text
\newpage
\backmatter
\begingroup
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Allegati}
\listoffigures
\listoftables
%\listof{grafico}{Elenco dei grafici}
\endgroup
\end{document}
EDIT1:
This way you redefine the plain-style that is used by every chapter-page in your document.
If you do not want to change it document-wide, your approach is correct; just add a \clearpage before the last \endgroup. It won't create a new page, but delete the pagenumber. Btw, if you don't really need the \begingroup \endgroup leave it out, this will also delete the last page number.
END-EDIT1
A few things to note:
If you use plain book-class, you can use fancyhdr for setting a
page style like in the above example. Later just load the wanted
pagestyle and from there on it will be used.
If you want to write a document according to the modern
standard of LaTeX, maybe think about using a KOMA-class, which
provides great functions for changing the page style (and often they
also work better ;))
For me this MWE does work, having no pagenumber on the last page; if it does not for you, please give us more information about your document.

Use fancyhdr in Lyx to position page number

I am trying to customise the position of the page number to make them all appear at the bottom centre in Lyx. I plan to use the fancyhdr package in the preamble section of the document, but I get the following error msg:
'LaTex Error: Command /footruleskip already defined'
I guess it has something to do with me forcing a footnote formatting which may already be defined by fancyhdr package, as i have the following in my preamble:
\setlength{\skip\footins}{0.8cm}
Any suggestion how I get around this problem and set the page number position together with the footnote setting? Many thanks.
This link should help: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customising_with_fancyhdr. You can use the lhead, chead, rhead, lfoot, cfoot and rfoot commands to tell it what you what where (section names, page numbers, custom text, etc). I think you still need to specify them even if they are empty. For only a page number at the bottom center, that would be:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
Perhaps your error could be fixed by using \renewcommand instead of trying to define an already existing value.
I'm trying to do my thesis with LyX and small problems like this are killing me because of having to adhere to the strict format of my school. Anyhow, this page came up as I searched for over an hour for the answer to your question. I'm using the memoir layout (kind of, I've already had to edit it) because my school's latex .cls file is supposedly based on memoir.cls (which I couldn't get to work correctly with LyX despite hours of persistence). I ended up putting this code into my preamble and it displayed the page numbers in the bottom-center per my formatting requirements.
\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}
Hope this helps anyone else that finds this page. Now if I can just figure out how to tell LyX that I have no chapters and I want sections to be 1 instead of 0.1. I'll probably just use section* and call my sections "Section" #. Anyway, I hope this helps someone who is as close to punching themselves in the face for using LyX as I am.

Making Latex typeset given text on two facing pages

How do I encourage/make Latex typeset some portion of text so that it will all appear on a consecutive even-page, odd-page pair of pages?
With trial and error, \nopagebreak can be coaxed into doing this, but is there a strategy that Just Works? Something like a samepage environment would be ideal, but one that:
Will force a pagebreak on odd pages if that is needed to get all the text on facing pages;
Allows up to one page break anywhere in the environment body, and fails noisily if that can't be ensured.
You could put together an environment such as
\newenvironment{twopage}{%
\begingroup\setbox0\vbox\bgroup
}{%
\egroup
\ifdim\ht0>\textheight
\setbox1\vsplit0 to \textheight
\cleardoublepage\unvbox1\clearpage
\ifdim\ht0>\textheight
\PackageWarning{twopage}{Overflow in twopage environment}%
\fi
\unvbox0\clearpage
\else
\clearpage\unvbox0\clearpage
\fi\endgroup
}
If you want a noisier failure, change \PackageWarning into \PackageError, The \unvboxes should allow for notes/floats to work properly - if you don't need that, you might consider changing them all to \boxes instead (although I'm a bit rusty on the behavior of \vsplit with respect to box depths and skips, so that might produce funny behavior, but it would guarantee that you only took two pages by flowing anything extra off the bottom of the second page).
There is a distinction between \clearpage and \cleardoublepage. By using \cleardoublepage just before the stuff you want on the left hand side and \clearpage before the stuff you want on the right hand side you can force the layout you're looking for.
Of course, the twoside option is must.

glossaries package and footnote in LaTeX

I am currently stuck, having two separate glossaries: main & acronyms. Acronyms glossary prints footnotes on first use in the text, but main glossary does not. Is there any way to make any other glossary than acronyms to print footnote on first use of the term? I don't get how to do it.
Here is the code example compiled with TeXnic Center and MiKTeX 2.7:
\documentclass{article}
\usepackage{index}
\usepackage[toc,style=long3colheaderborder,footnote,acronym]{glossaries}
\makeindex
\makeglossaries
\newglossaryentry{appdomain}{name={application domain}, description={app Domain Description...}}
\newglossaryentry{sample}{name={[has been inserted aaa]},description={testing testing 123}}
\newacronym{aca}{aca}{a contrived acronym}
\begin{document}
\section{this is a test section}
This is the test line... a \gls{sample} \gls{appdomain}
\index{entry} and \gls{aca}
\thispagestyle{empty}\cleardoublepage
\printglossary[type=main,title={Glossary},toctitle={Glossary}]
\thispagestyle{empty}\cleardoublepage
\printglossary[type=\acronymtype,title={List of Abbreviations},toctitle={List of Abbreviations}]
\printindex
\thispagestyle{empty}\cleardoublepage
\end{document}
I want sample and appdomain either contain a footnote with description or a footnote stating: please refer to Glossary
Many thanks,
Ovanes
In short, with the glossaries package, you can't get footnotes on the first use for non-acronym glossaries.
However, you can redefine some commands in the preamble (after you \usepackage{glossaries}) to get what you want:
\makeatletter
\renewcommand{\gls#main#displayfirst}[4]{
#1#4\protect\footnote{#2}
}
\makeatother
But that will be really fragile.
I think there is an easier way of doing this. Maybe it's new, but
\defglsdisplayfirst[main]{#1#4\protect\footnote{#2}}
appears to achieve the exact same thing (correct me if I'm wrong). See the glossaries manual, version 2.03, subsection 2.4.1 changing the format of the text.
Unfortunately, it appears commands like \gls or \autoref does not work in those footnotes.
Following is a good technique, to put a footnote stating where the definitions are:
\label{nom} %put this on the page your term appears, so that it can collect page number
\newcommand{\g}{\footnote{For all abbreviations see the glossary on page \pageref{nom}.}}
I've found this from here.

Resources