I saw a book that besides its main content had the text from another book squeezed in the bottom margin. I'm wonder whether this is possible to do with LaTeX? More specifically I'm wondering whether it's possible to have two separate text and produce output such that one text goes in the main content area of the page and the other in the margin? Note that both texts may not fit on one page but needs to run over several pages.

  • 2
    Instinct tells me that this is not possible to do concurrently. However, it would be possible if the documents were produced separately, with the appropriate layouts - one document with margins set up for the body text, and another set up for the margin text. Then, the main body text could include the margin text using pdfpages or a page-wise \includegraphics.
    – Werner
    Oct 4, 2011 at 7:15
  • Very interesting question. Out of curiosity: do you have a citation/reference for this book, or could you scan and post a representative-looking page?
    – Mico
    Oct 4, 2011 at 10:09
  • @Mico Afraid I haven't got a reference.
    – N.N.
    Oct 10, 2011 at 13:11
  • @N.N. How long is the full text, typically? (to know whether the full set of typeset pages can be stored into memory or not) Oct 22, 2011 at 23:21
  • @BrunoLeFloch I don't have a particular text I need to typeset. I'm just interested in the possibility of doing this. To have something to work with, say that I want to merge two articles with this technique.
    – N.N.
    Oct 23, 2011 at 18:08

3 Answers 3


A very rough approach, collecting the material for the other book in a vertical box, and using \vsplit to split the top part of that box and put it on the left of the main text. Admittedly, the result is not good, but it might be possible to polish it.

\textwidth=200pt\relax %??

\box_new:N \l_otext_tmpa_box
\box_new:N \g_otext_box
\dim_new:N \g_otext_prevdepth_dim
\skip_new:N \l_otext_sep_skip
\skip_set:Nn \l_otext_sep_skip { 20 pt }
\dim_new:N \g_otext_side_width_dim
\dim_gset:Nn \g_otext_side_width_dim { 100 pt }
    \vbox_gset:Nw \g_otext_box
        \vbox_unpack_clear:N \g_otext_box
        \dim_gset_eq:NN \tex_prevdepth:D \g_otext_prevdepth_dim
        \dim_set_eq:NN \l_galley_width_dim \g_otext_side_width_dim
        \bool_gset_false:N \g_galley_omit_next_indent_bool
      \dim_gset_eq:NN \g_otext_prevdepth_dim \tex_prevdepth:D
% Patch \output.
\tl_set:Nx \l_tmpa_tl { \the\output }
\tl_put_left:Nn \l_tmpa_tl
    \vbox_set_split_to_ht:NNn \l_otext_tmpa_box \g_otext_box
      { \box_ht:N \@cclv + \box_dp:N \@cclv }
    \vbox_set:Nn \@cclv
            \box_use_drop:N \l_otext_tmpa_box
            \skip_horizontal:N \l_otext_sep_skip
            \box_use_drop:N \@cclv
\exp_args:No \output \l_tmpa_tl


  \section{Paragraphs 1 and 2}

  \section{Paragraphs 3 and 4}

\section{Paragraphs 11 to 13}

  \section{Paragraphs 5 to 7}

\section{Paragraphs 14 to 27}

  • Thanks for your answer. When I try to compile with pdflatex from TeX Live 2011 I get ! Missing number, treated as zero. <to be read again> ) l.54 \lipsum[1-2]
    – N.N.
    Oct 26, 2011 at 6:36
  • @N.N. Do you have the latest xgalley? (And the rest of expl3?) (> Oct 11, I'd say) Oct 26, 2011 at 11:12
  • I did a tlmgr update --all today, is that sufficient?
    – N.N.
    Oct 26, 2011 at 11:26
  • Is it possible to get LaTeX's standard justification with this?
    – N.N.
    May 5, 2012 at 10:09
  • @N.N. Remove \raggedleft and \raggedright, and if necessary add \sloppy just after \begin{document}. May 6, 2012 at 9:33

You can use \marginpar to put the second book in the margin. I prepared a sample that shows a figure, a table and some text. The sidefigure and sidetable environments are taken from the sidenotes package. It would be possible to put a whole book in the margin.

Two things would have to be addressed: How are the 'two books' synchronized, i.e. where are the page breaks and what happens if your first book fits on the page, but the one in the margin does not. It would even be possible to float the second book in the margin across pages, lets say for a chapter. You could use the marginfix package for that. If you want to try that, first put the complete chapter of the second book in the margin, then put the first book. You might have to use the morefloats package as well.

The second thing is the numbering. How are the figures and tables supposed to be numbered? Independently with a prefix, subsequently or something else?

Please change the filename in the \includegraphics macro to try the sample.

Also, it turns out that marginfix needs the paragraphs in the second document one at a time. So instead of \marginpar{\lipsum[1-2]} it wants \marginpar{\lipsum[1]}\marginpar{\lipsum[2]}.


\usepackage[paperwidth=170mm, paperheight=240mm, left=40pt, top=40pt, textwidth=220pt, marginparsep=20pt, marginparwidth=160pt, textheight=560pt, footskip=40pt]{geometry}

{ \end{minipage}%
{ \end{minipage}%

%% this is document 2

\caption{This is the caption}

 % \fontfamily{ppl}\selectfont
     Hg&Sn&Pb&Cd&Tl \\
\caption{A table}



%% this is document 1


  • Thanks for your answer. When I put more text in document 2 it doesn't expand past page 1.
    – N.N.
    Oct 26, 2011 at 6:31
  • The marginfix package does that trick. Then the text floats on the next page.
    – Andy
    Oct 26, 2011 at 6:49
  • When I load the marginfix package and change \marginpar{\lipsum[4]} to \marginpar{\lipsum[4-8]} I get ! Package marginfix Error: lost some margin notes.
    – N.N.
    Oct 26, 2011 at 6:53
  • You have to use the morefloats package as well.
    – Andy
    Oct 26, 2011 at 6:55
  • I still get the same error with morefloats. Could you please include a working example with these additions in your answer?
    – N.N.
    Oct 26, 2011 at 6:57

You may use the footnote to do this. If you squeeze an other text at the bottom of a page, you probably won't have additional footnotes as well anyhow or you could try using one of the packages that allow multiple footnotes. (Must admit I didn't try this...) Or you could use marginal notes instead. Check out this:



% Don't print a footnote number:

% Reserve 40 % of a page for the squeezed contents:

% Let footnotes break across pages without penalities:

  % If the squeezed text is longer than the main part, allow it to fill the
  % entire page:
  • Thanks for your answer. Is it possible to let the text have their own footnotes when using this method? Also, I failed to insert a float in the second text, the one inserted as footnote.
    – N.N.
    Oct 11, 2011 at 6:16
  • The main text can have notes via one of the ways pointed out above. The bigfoot package allows to have nested footnotes (i.e. footnotes in the "squeezed" text) if I remember correctly. But I don't think that there is a way to allow objects to float inside a footnote. Non-floating figures and tables are certainly possible.
    – 5gon12eder
    Oct 11, 2011 at 22:51
  • Ok, Ideally I would like two independent texts on the same page with no restrictions either, e.g. the possibility of using floats.
    – N.N.
    Oct 12, 2011 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .