LaTeX/Page Layout : Différence entre versions
(Borrowed mostly to Lars Madsen) |
(→How page styles work in memoir : page on foot example) |
||
| Ligne 51 : | Ligne 51 : | ||
which means that the ''page number'' is on top right on odd pages (and top left on even pages) while the current heading (chapter title etc.) is slanted and opposite to page number. | which means that the ''page number'' is on top right on odd pages (and top left on even pages) while the current heading (chapter title etc.) is slanted and opposite to page number. | ||
| + | == Simple page number centered in the foot == | ||
| + | <source> | ||
| + | \documentclass[a4paper]{memoir} | ||
| + | \begin{document} | ||
| + | |||
| + | \makepagestyle{pageonfoot} | ||
| + | |||
| + | \makeoddfoot{mystyle}{}{\thepage}{} | ||
| + | \makeevenhead{mystyle}{}{\thepage}{} | ||
| + | |||
| + | \pagestyle{pageonfoot} | ||
| + | |||
| + | \end{document} | ||
| + | </source> | ||
<noinclude> | <noinclude> | ||
{{LaTeX/Bottom|Tables|}} | {{LaTeX/Bottom|Tables|}} | ||
</noinclude> | </noinclude> | ||
Version du 30 juin 2011 à 16:00
The reference is http://tug.org/pracjourn/2008-2/madsen/madsen.pdf:
The standard classes (book, article, report), are not particularly flexible. There are basically no configuration interfaces at all; one needs to resort to external packages.
In the area of page styling, the situation in the standard classes is no different. The standard classes have several annoying features regarding the material used in the page styles.
- All mark content provided by \chapter, \section, etc. are hardwired to be in upper case.
- Marks set by macros and environments such as \tableofcontents, the bib- liography and the index are all in upper case. This feature cannot easily be changed without having to copy a large number of code lines and then only changing one or two lines of that code.
- In case your setup allows a blank page before starting a new chapter (default in the book class), that »blank« page is not really blank; it has the same page style as all other regular pages, which looks odd if there is no other content on the page. The solution is to manually change \cleardoublepage in order
to automatically make these pages truly blank.
- There is no easy way to redesign the look of the footers and headers.
- Creating truly flexible sectional marking macros — \chaptermark, \sec-
tionmark, etc. used internally by \chapter etc. — demands a lot of LATEX knowledge from the (novice) user.
Sommaire
The fancyhdr package
The fancyhdr package can handle several of these problems but with some costs. Also fancyhdr isn't compatible with the memoir class which also have fancy heading facilities.
Page styling in memoir
In memoir we deal with two types of page styles, aliases and regular page styles. An alias page style is a style that just refers to another style, i.e. if the style alias is an alias for the empty style, then \pagestyle{alias} is the same as \pagestyle{empty}.
The advantage of having aliases is that we can, for example, provide the first page of a chapter with its very own page style without the need to create a specific style for it.
We just let the chapter style point to some other style, say, plain; and if we later decide that we want a different look for the chapter title page, then we just let chapter point to some other page style.
How page styles work in memoir
As mentioned earlier the headers and footers are added to the page via the four macros \@evenhead, \@oddhead, \@evenfoot and \@oddfoot. In memoir a given page style ⟨style⟩ consists of a number of specially created macros, all associated with the name ⟨style⟩, and activating ⟨style⟩ causes LATEX to rebuild those four macros using the current content of the macros associated with ⟨style⟩.
The memoir page style interface interacts with the special macros associated with ⟨style⟩.
- \pagestyle{empty}
- \pagestyle{plain}
- \pagestyle{headings}
- \pagestyle{ruled}
- \pagestyle{Ruled}
The main macros for dealing with the design of the headers and footers are:
- \makeevenhead{⟨style⟩}{⟨left⟩}{⟨center⟩}{⟨right⟩}
- \makeoddhead{⟨style⟩}{⟨left⟩}{⟨center⟩}{⟨right⟩}
- \makeevenfoot{⟨style⟩}{⟨left⟩}{⟨center⟩}{⟨right⟩}
- \makeoddfoot{⟨style⟩}{⟨left⟩}{⟨center⟩}{⟨right⟩}
and in order to manage rules:
- \makeheadrule{⟨style⟩}{⟨width⟩}{⟨thickness⟩}
- \makefootrule{⟨style⟩}{⟨width⟩}{⟨thickness⟩}{⟨skip⟩}
- \normalrulethickness
Thus the standard headings style is simply:
- \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
- \makeevenhead{headings}{\thepage}{}{\slshape\rightmark}
which means that the page number is on top right on odd pages (and top left on even pages) while the current heading (chapter title etc.) is slanted and opposite to page number.
Simple page number centered in the foot
Langage invalide
Vous devez spécifier un langage comme ceci : <source lang="html4strict">...</source>
Langages supportés pour la coloration syntaxique :
4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic
\documentclass[a4paper]{memoir}
\begin{document}
\makepagestyle{pageonfoot}
\makeoddfoot{mystyle}{}{\thepage}{}
\makeevenhead{mystyle}{}{\thepage}{}
\pagestyle{pageonfoot}
\end{document}