3

Using the memoir package, I would like to have a vertical line on my margin like this:

Some leading content

      ... vertical space ...

----------------------------------
 XYZ  | Content A
      |
      | Content B
      |
      | Content C
      |
      | ...
      |
      | Content N

   *** page break ***

      | Content A1
      |
      | Content B1
      |
      | Content C2
      |
      | ...
      |

  ...

I would like the content XYZ to be in a margin note or paragraph (marginpar, and the vertical line to follow the margin of the page, with the content A being in a page the width of that area.

The content will span multiple pages, and be somewhat complex - with e.g. multiple tables that may themselves span pages, and justified content. In essence, the body of the document will be Content * - so I would like to have that be the body of the page.

So on my TODO list I have the following:

  1. Set the margin of the page to be larger (\oddsidemargin);
  2. Add lead-in content that is set at the standard margin position;
  3. Add a vertical line along the page margin that spans multiple pages;
  4. Add margin paragraphs (for "XYZ").

I had in fact figured this out before, but have since forgotten and lost how I worked it out, so am posting in part to preserve the solution but also because I'm sure just about everybody reading this will know better than I how to achieve the objective. I will post my own solution once I re-discover it.

Though I will post my answer with more details, here are my initial thoughts:

  1. Using longtable or equivalent to solve 1, 2, 3 and 4 had crossed my mind, instead of mucking around with page dimensions and such, but as mentioned the "Content *" will include tables and such. It can be worked around I am sure, but it struck me as less elegant than setting the page dimensions accordingly.

  2. Otherwise problems 2, 3 and 4 seem to be mostly an implementation issue with memoir, notwithstanding the vertical line - I cannot recall if that

  3. If the other can be achieved, I am tempted to use the textpos package to solve problem 2.

  4. Vertical rules using the e.g. 'background' package to solve problem 3.

  • The side margin paragraphs will be unique? I mean, there will be just one for each use of the construct, or will there be possibly many margin paragraphs in one construct? The horizontal rule will always be in the same position? – Gonzalo Medina May 16 '13 at 21:53
  • @GonzaloMedina: Thanks for the comment. The side margins will be simple text (maybe italicized, bold, ...), so nothing really special; the horizontal rule will basically always be in the same position and relative to the height of the preamble. – Brian M. Hunt May 16 '13 at 22:43
1

What if you abused the geometry package?

%\documentclass[12pt]{memoir}
\documentclass[oneside, 12pt]{memoir}
\usepackage[showframe]{geometry}
\usepackage{lipsum,longtable}

\makeatletter % <-- all from geometry.sty, but with some lines commented out

\renewcommand*{\Gm@vrules@mpi}{%
  \hb@xt@\@tempdima{\llap%{\Gm@vrule}
  \ignorespaces
  \hskip \textwidth\Gm@vrule
  \hskip \marginparsep
  %\llap{\Gm@vrule}\hfil\Gm@vrule
}}%
\renewcommand*{\Gm@vrules@mpii}{%
  \hb@xt@\@tempdima{\hskip-\marginparwidth\hskip-\marginparsep
  %\llap{\Gm@vrule}
   \llap{}
\ignorespaces
  \hskip \marginparwidth
  \rlap{\Gm@vrule}
 \hskip \marginparsep
 \llap{}
 %  \llap{\Gm@vrule}
 \hskip\textwidth
  \rlap{}
% \rlap{\Gm@vrule}
\hss}}%
\newif\ifGm@pageframes
\Gm@pageframestrue
\renewcommand*{\Gm@pageframes}{%
  \vb@xt@\z@{%
   \ifGm@showcrop
    \vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset%
     \hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset%
      \vb@xt@\Gm@layoutheight{%
       \let\protect\relax
       \hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,1,-3,3)\hfil\Gm@cropmark(1,1,3,3)}%
       \vfil
       \hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,-1,-3,-3)\hfil\Gm@cropmark(1,-1,3,-3)}}%
     \hss}%
    \vss}%
   \fi%
   \ifGm@showframe
    \if@twoside
     \ifodd\count\z@
       \let\@themargin\oddsidemargin
     \else
       \let\@themargin\evensidemargin
     \fi
    \fi
    \moveright\@themargin%
    \vb@xt@\z@{%
     \vskip\topmargin%\vb@xt@\z@{\vss\Gm@hrule}%
     \vskip\headheight%\vb@xt@\z@{\vss\Gm@hruled}%
     \vskip\headsep%\vb@xt@\z@{\vss\Gm@hrule}%
     \@tempdima\textwidth
     \advance\@tempdima by \marginparsep
     \advance\@tempdima by \marginparwidth
     \if@mparswitch
      \ifodd\count\z@
       \Gm@vrules@mpi
      \else
       \Gm@vrules@mpii
      \fi
     \else
      \Gm@vrules@mpi
     \fi
     % \vb@xt@\z@{\vss\Gm@hrule}%
     % \vskip\footskip\vb@xt@\z@{\vss\Gm@hruled}%
     \vss}%
    \fi%
  }}%

\makeatother

\begin{document}

a \marginpar{test}\lipsum

\newpage
b \marginpar{test}
\begin{longtable}{p{4in}}
\lipsum
\end{longtable}

\end{document}

To make for a tidier .tex file, you could wrap this in a personal package of your own, prefaced with \RequirePackage[showframe]{geometry} and then just load it on its own: \usepackage{<filename>}

0

Here is what I have done, with a preamble as follows:

\documentclass[oneside,12pt]{memoir}

\usepackage{lipsum}

\usepackage{everypage}
\usepackage[absolute]{textpos}%

% textpos settings
\setlength{\TPHorizModule}{1cm}%
\setlength{\TPVertModule}{1cm}%
\TPMargin{0.0cm}%

% page dimensions
\settrimmedsize{11in}{8.5in}{*}
\settrims{0pt}{0pt}
\settypeblocksize{8in}{10.5in}{*}
\setlrmarginsandblock{4cm}{0.5in}{*}
\setulmarginsandblock{2cm}{1.5cm}{*}
\setheaderspaces{0cm}{*}{*}
\checkandfixthelayout[nearest]

% sidebars
\sidebarmargin{left}
\renewcommand{\sidebarfont}{\footnotesize}
\setlength\sidebarwidth{2.6cm}
\setlength\sidebartopsep{6cm}
\renewcommand*{\sidebarform}{\raggedright}

To create the full-page vertical bar on every page I use everypage:

% everypage - add vertical line
\AddEverypageHook{
    % height is 29.21 (stock height - 11.5in) - 2cm - pad (2cm) = 25cm 
    \ifnum\thepage>1
    \begin{textblock}{1,25}(3.5,1)
        \rule{0.2pt}{25cm}
    \end{textblock}
    \fi
}

In the document I have on the first page:

\begin{textblock}{5}(2,2.2)
 \parbox{5cm}{%
   This appears in a static position.
 }
\end{textblock}

% horizontal line
% ~ width of stock 21.6cm (8.5in) minus 3cm for margins
\begin{textblock}{18,1}(1,7)
\rule{19.6cm}{0.2pt}
\end{textblock}

% vertical line (part of page; leaving room for header}
% ~ height is 29.21 (stock height - 11.5in) - 6cm - pad (2cm) = 21cm 
\begin{textblock}{1,21}(3.5,7)
\rule{0.2pt}{21cm}
\end{textblock}

\sidebar{Some sidebar text}

... Content A-Z

Of course, I will mark as correct an answer that substantially improves on this.

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.