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.

Questions summed up below!

I want to convert a number of old (read: ugly self-coded html) tutorials into pdfs. They are still read by people, so I think it's worth the effort. The other reasons:

  • readers repeatedly asked for a printable version, for side-reading;

  • they want to print them out to make notes and drawings (I could also interpret this as a demand for rephrasing, but I don't.);

  • I want to use what I have learned about typography.

My approach starts with the demand for space for personal notes. They will probably go into the margin, because the margin usually provides some space. The tutorials are aimed at beginners in the subject, and a lot of the content is extremely simplified. This calls for inline notes, footnotes or marginal notes. I want a wide margin for the readers' personal notes, and I also want to use the margin for notes in the tutorial.

Now that the margin is wide, I can also place figure and table captions (I need both!) in the margin, and this is where I'm stuck. I've tried Will Robertson's suggestion from this Q&A, but the marginal caption is placed on top of the text. The code below is his, but turned in to an MWE:

\documentclass{article}

\usepackage{lipsum}

\makeatletter
\newcommand\margincaption[1]{%
  \par
  \setbox\@tempboxa=\hbox{\parbox{\marginparwidth}{\caption{#1}}}
  \@tempdima=\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax
  \par\null\hfill\usebox\@tempboxa\par
  \vspace*{\dimexpr-\@tempdima-\baselineskip\relax}
}
\makeatother

\begin{document}

\lipsum[1]
\begin{figure}[tp]
\rule{\textwidth}{1em}
\margincaption{A black long line with lots of explanation so it fills up some space.}
\end{figure}
\lipsum[2]
\end{document}

I have tried ConTeXt for this, but the caption setting rightmargin produces no caption at all. I have asked the mailing list, but I've got the impression that it might be possible with pdfLaTeX (or XeTeX, or luaLaTeX) as well.

Yet another issue pops up when I need to include long lines of example code. The margin is wide, so the main text area is narrower than usual, which could lead to collisions. Anyway, is there a way to include over-long lines without generating an overfull hbox warning? This is a minor issue though - long lines can be broken.

  • How can I place figure and table captions in the margin?

  • How can I include single lines, extending into the margin, without producing collosions?

  • If you have the impression that my layout approach is not suitable, do you have a brilliant idea I could try instead?

share|improve this question
2  
Use the tufte-book class, it has exactly what you are looking for. –  Yiannis Lazarides Jun 14 '11 at 20:07
    
@Yiannis: Thank you! That class looks perfect. Why didn't you post your comment as an answer? –  Christoph Jun 14 '11 at 20:25
    
I thought it was important to point you at the right direction and see if you were comfortable with that, don't worry about points, you can accept N.N's answer. I gave it a click myself also. –  Yiannis Lazarides Jun 14 '11 at 20:32
add comment

3 Answers

up vote 7 down vote accepted

As others have said, you can use the tufte-book document class. It offers captions in the sidenotes area and a fullwidth environment that stretches across the main text block and the sidenotes area.

\documentclass{tufte-book}
\usepackage{lipsum}

\begin{document}

\lipsum[1]
\begin{figure}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{A black rectangle with lots of text so it fills up some space.}
\end{figure}
\lipsum[1]
\begin{table}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{A black rectangle with lots of text so it fills up some space.}
\end{table}
\begin{fullwidth}
\lipsum[1]
\end{fullwidth}

\end{document}

If you don't want to use the tufte-book class, then you can use one of the standard ones (book, report) together with the geometry package to change the page layout, the floatrow package to have captions in the margins, and the changepage package to change the margins for a part of a document:

\documentclass{book}
\usepackage[margin=4cm,marginparwidth=3cm]{geometry}
\usepackage{floatrow}
\usepackage{changepage}
\usepackage{lipsum}

\floatsetup{margins=hangleft,capposition=beside,
capbesideposition={top,left},floatwidth=\textwidth}

\begin{document}

\lipsum[1]
\begin{figure}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{A black rectangle with lots of text so it fills up some space.}
\end{figure}
\lipsum[1]
\begin{table}[!ht]
  \centering
  \rule{4cm}{2cm}
  \caption{A black rectangle with lots of text so it fills up some space.}
\end{table}
\begin{adjustwidth}{-3cm}{}
\lipsum[1]
\end{adjustwidth}

\end{document}

You could also consider using one of the classes from the KOMA-Script bundle (scrbook, scrreprt) or the memoir document class and adapting them to your needs.

share|improve this answer
    
I like the alternatives you presented, but I think tufte-handout is the best match. Thank you! I wish I could accept more than one answer. –  Christoph Jun 14 '11 at 20:56
add comment

This is an answer to your last question:

If you have the impression that my layout approach is not suitable, do you have a brilliant idea I could try instead?

Maybe tufte-latex is for you. Here is an example of a handout. See that it contains figures and notes in the margin.

Also you may be interested in classicthesis and its derivate arsclassica, they have similar features as tufte-latex. The same goes for Uggedal’s. Check out the links for examples of their looks.

share|improve this answer
    
I don't have the impression that this is an answer to my third question, but rather to the first! Yiannis was a bit faster with his comment - I'd like to accept his comment as an answer. I'll see if more suggestions come in. –  Christoph Jun 14 '11 at 20:23
    
@Christoph I understood the question as you asking for a layout you could use instead of the one you tried to construct on your own. –  N.N. Jun 14 '11 at 20:29
    
you understood me correctly! Nonetheless, you answer answers my first question more than my third question, because it doesn't provide an alternative, but exactly what I wanted. –  Christoph Jun 14 '11 at 20:55
add comment

You can try

caesar_book.cls

given by sidnotes package

http://www.ctan.org/tex-archive/macros/latex/contrib/sidenotes

share|improve this answer
add comment

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.