Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am interested in the following page layout.

  1. How to have headers in margins (up to margin)
  2. Is it possible to start section headings from margin
  3. How to set figures occupy the margins.

I can make an MWE as given below

    \documentclass[12pt,a4paper]{scrbook}

\usepackage[demo]{graphicx}

\usepackage[calcwidth]{titlesec}

%\titleformat{\section}[leftmargin]
%{\normalfont
%\sffamily\bfseries\filleft}
%{}{0pt}{}
%\titlespacing{\section}
%{4pc}{1.5ex plus .1ex minus .2ex}{1pc}

\newlength\mylen
\setlength\mylen{\dimexpr\oddsidemargin+1in+\hoffset\relax}

\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\llap{\hspace*{-\mylen}\thesection\hfill}}{0em}{}
  [{\makebox[\linewidth][l]{%
    \hspace*{-\mylen}\rule{\dimexpr\textwidth+\mylen\relax}{1pt}}}]

%titleps is alternate for fancyhdr
%
\usepackage{titleps}

%\newpagestyle{main}[\small\sffamily]{
\newpagestyle{main}{
\widenhead[4pc][0pt]{4pc}{0pt} %for scrbook
%\widenhead[6pc][0pt]{0pt}{6pc} %for scrbook
%\widenhead[0pt][6pc]{6pc}{0pt} %for scrartcl
\headrule
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{\textsl{\chaptertitle}}
{\textbf{\thepage}}
}
\pagestyle{main}

\renewpagestyle{plain}[\small\sffamily]{
%\footrule
%\setfoot[\textbf{\thepage}]
\setfoot
[]
[]
[]
{}
{}
%{\textbf{\thepage}}
{}
%
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{}
{\textbf{\thepage}}
}



\begin{document}

\chapter{Chapter title}

\clearpage

\section{Section title}


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf

\section{ Section title}

%
\begin{figure}[hb]
%\centering
\includegraphics[width=0.2\linewidth]{}
%\label{fig:p6a}
\caption{Figure caption}
\end{figure}
%


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

\clearpage

\section{title}
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf    

\end{document}

The output : Even page enter image description here

Odd page enter image description here

I want change the figure position to the margin...

Possible Solution Place figures side by side, spill into outer margin

share|improve this question
    
I made your title a bit more specific, hope you don’t mind. –  doncherry May 16 '13 at 6:22
    
You can have a look at tufte-latex, see for instance the sample book (360kB). –  Tom Bombadil May 16 '13 at 6:28
    
The manual of fancyhdr shows how this can be done. –  egreg May 16 '13 at 9:40
    
@egreg I have used "titleps" to increase the headers width... –  sandu May 17 '13 at 4:13
    
also you could take a look at floatrow package for caption (and figure i guess) placement... –  guillem May 17 '13 at 5:32

1 Answer 1

up vote 2 down vote accepted

This fix includes several points:

1) \usepackage{calc}

2) New caption definition to make it left justified:

\newcommand\mycaption[1]{\caption{%
  \leftskip-\mylen#1\protect\rule{\textwidth-\mylen}{0in}}}

3) \leftskip the margin for the figure environment

\begin{figure}[hb]
\setlength\leftskip{\leftskip-\mylen}
\includegraphics[width=0.2\linewidth]{}
\mycaption{Figure caption}
\end{figure}

Caveat: I didn't fix your pre-existing problem with margins on page 3.

\documentclass[12pt,a4paper]{scrbook}

\usepackage[demo]{graphicx}
\usepackage{calc}

\usepackage[calcwidth]{titlesec}

%\titleformat{\section}[leftmargin]
%{\normalfont
%\sffamily\bfseries\filleft}
%{}{0pt}{}
%\titlespacing{\section}
%{4pc}{1.5ex plus .1ex minus .2ex}{1pc}

\newlength\mylen
\setlength\mylen{\dimexpr\oddsidemargin+1in+\hoffset\relax}

\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\llap{\hspace*{-\mylen}\thesection\hfill}}{0em}{}
  [{\makebox[\linewidth][l]{%
    \hspace*{-\mylen}\rule{\dimexpr\textwidth+\mylen\relax}{1pt}}}]

%titleps is alternate for fancyhdr
%
\usepackage{titleps}

%\newpagestyle{main}[\small\sffamily]{
\newpagestyle{main}{
\widenhead[4pc][0pt]{4pc}{0pt} %for scrbook
%\widenhead[6pc][0pt]{0pt}{6pc} %for scrbook
%\widenhead[0pt][6pc]{6pc}{0pt} %for scrartcl
\headrule
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{\textsl{\chaptertitle}}
{\textbf{\thepage}}
}
\pagestyle{main}

\renewpagestyle{plain}[\small\sffamily]{
%\footrule
%\setfoot[\textbf{\thepage}]
\setfoot
[]
[]
[]
{}
{}
%{\textbf{\thepage}}
{}
%
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{}
{\textbf{\thepage}}
}



\begin{document}

\chapter{Chapter title}

\clearpage

\section{Section title}


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf

\section{ Section title}

\newcommand\mycaption[1]{\caption{%
  \leftskip-\mylen#1\protect\rule{\textwidth-\mylen}{0in}}}
%
\begin{figure}[hb]
\setlength\leftskip{\leftskip-\mylen}
%\centering
\includegraphics[width=0.2\linewidth]{}
%\label{fig:p6a}
\mycaption{Figure caption}
\end{figure}
%

skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

\clearpage

\section{title}
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf    

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.