10

I'd like to have an empty box on the bottom of my pages in a certain chapter. I've messed around with wrapfigure and kinda sorta gotten something that looks okay, but I'd like to do it properly so I can publish my files as a template eventually.

The box should stay in the same position on each page and the text should wrap around it.

MWE:

\documentclass[a4paper,book,openany,10pt]{memoir}

\usepackage{wrapfig}
\makepagestyle{mm}
\makeevenhead{mm}{\textsc{Manus}}{}{}
\makeoddhead{mm}{}{}{\textsc\leftmark}
\makeevenfoot{mm}{\thepage}{}{}
\makeoddfoot{mm}{}{}{\thepage}
\makeheadrule{mm}{\textwidth}{1pt}
\nouppercaseheads
\pagestyle{mm}
\begin{document}
\thispagestyle{empty}
\chapter{Bar}
No boxes in this chapter!
\chapter{Foo}
Blah Blah Blah

Box goes here!

\end{document}

The final result should look something like this:

image

First post and all that. Let me know if you need more info, and I hope someone can help!

  • 2
    in TeX line breaking happens before pagebreaking so it is very hard to have an insert at a fixed page position that allows text to flow past as the line length needs to change back to full width at the page break. If you have forced page breaks where the line length changes it is _much easier. It is possible to set up a multi-pass system, which measures on one pass and sets up the line lengths on the next, but that may take a lot of latex runs to stabilise – David Carlisle Jun 23 '13 at 10:19
  • 2
    yes if you force each pagebreak with clearpage it's much easier to have a command that sets the last paragraph with the inserted box then forces a break and goes back to full width text, than to have the linewidth change be automatically triggered by an automatic page break. – David Carlisle Jun 23 '13 at 11:39
  • 2
    in the posted figure, the inserted box also influences the penultimate paragraph; so I think the macro will have to be a clever one if it is destined to be used in a paragraph but retro-actively modify the shape of the previous one. Perhaps wrapfig does these things? – user4686 Jun 23 '13 at 12:44
  • 1
    @jfbu yes (and I have no tine today) it's still tricky, I was just checking if a forced break was acceptable as otherwise it's not really possible with a reasonable amount of code. – David Carlisle Jun 23 '13 at 12:47
  • 1
    Off the wall possible strategy. Perhaps define two types of pages or minipages, long and short, whose combined length is the real page length. Adjust the text width and placement on the short page to allow space for the box. Adjust header and footer sizes (to 0?) so that the pages join with no space between lines. I don't know enough to know whether this can be done. – Ethan Bolker Jun 23 '13 at 13:33
1

You can use the wrapfigure environment with a framebox.

The "2in" \wrapfigure:

\begin{wrapfigure}{ri}{2in}{

Determines the position of the box relative to the margin. In this case it is the right margin.

The \rule command, inside the framebox environment, is used to create a black box, but in this case we can use it to determine the height of our \framebox, like this:

\rule[0mm]{0mm}{2cm}

Here's a WE:

 \documentclass[a4paper,book,openany,10pt]{memoir}
 \usepackage{wrapfig}
 \makepagestyle{mm}
 \makeevenhead{mm}{\textsc{Manus}}{}{}
 \makeoddhead{mm}{}{}{\textsc\leftmark}
 \makeevenfoot{mm}{\thepage}{}{}
 \makeoddfoot{mm}{}{}{\thepage}
 \makeheadrule{mm}{\textwidth}{1pt}
 \nouppercaseheads
 \pagestyle{mm}
 \begin{document}
 \thispagestyle{empty}
 \chapter{Bar}
  No boxes in this chapter!
  \chapter{Foo}
  Lorem ipsum dolor sit amet, ad sit veri dicit, idque dignissim intellegam at sea, duo  hinc graeco ea. Dictas facilisi ius et. In vim eripuit docendi. Nec eu tation latine facilis. Suas ipsum democritum nec an.

  Duo falli alterum perfecto cu, sit fugit falli populo ex. Tempor postulant hendrerit his at, porro noluisse in has. Ut solet complectitur ius, et his inani cetero. Et erant integre efficiendi eum. Omnes hendrerit te vis, ei assum tritani volumus vis, eum ex latine intellegebat.

  Quem nominati nec et. Usu adhuc fugit augue an, aeque liberavisse duo ei, id per habeo eloquentiam. Nullam cetero sententiae ea usu. His an accusam disputando, vix in aperiri officiis. Qui mentitum reformidans no, vocent laoreet ad mei, ei pro sumo soleat petentium.

  Nam ei iudicabit definiebas, sea ut veri sapientem, eum nobis ridens accusamus no. Nec odio sanctus facilisi te, nec sale dicit bonorum in. Vis te eripuit ancillae dissentiunt, sit labore audiam ea. Mei cibo omnis sonet ea.

  Lorem ipsum dolor sit amet, ad sit veri dicit, idque dignissim intellegam at sea, duo hinc graeco ea. Dictas facilisi ius et. In vim eripuit docendi. Nec eu tation latine facilis. Suas ipsum democritum nec an.

   Nam ei iudicabit definiebas, sea ut veri sapientem, eum nobis ridens accusamus no. Nec odio sanctus facilisi te, nec sale dicit bonorum in. Vis te eripuit ancillae dissentiunt, sit labore audiam ea. Mei cibo omnis sonet ea.
   Lorem ipsum dolor sit amet, ad sit veri dicit, idque dignissim intellegam at sea, duo hinc graeco ea. Dictas facilisi ius et. In vim eripuit docendi. Nec eu tation latine facilis. Suas ipsum democritum nec an.

    \begin{wrapfigure}{ri}{2in}{
    \framebox[5cm]{ \rule[0mm]{0mm}{2cm}}
     }
    \end{wrapfigure}

     Nam ei iudicabit definiebas, sea ut veri sapientem, eum nobis ridens accusamus no.  Nec odio sanctus facilisi te, nec sale dicit bonorum in. Vis te eripuit ancillae dissentiunt, sit labore audiam ea. Mei cibo omnis sonet ea.
     Nam ei iudicabit definiebas, sea ut veri sapientem, eum nobis ridens accusamus no. 
     Nam ei iudicabit definiebas, sea ut veri sapientem, eum nobis ridens accusamus no. Nec odio sanctus facilisi te, nec sale dicit bonorum in. Vis te eripuit ancillae dissentiunt, sit    labore audiam ea. 
  \end{document}

The final output is something like this:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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