# Set custom page text/line width in memoir for sidepars

I wish to lay out a page using the memoir package so it has dimensions something like this:

  #  <--        21.6cm (Letter stock)      -->  #
#  Margin | Content     | |  Note  |  Margin  #
#  2.5cm  | <- 10cm --> | |  5.4cm |  2.5cm   #
#         |              ^.6cm     |          #


Unfortunately I seem to be overlooking something in my attempts. Here is an example of what I have tried:

\documentclass[oneside,12pt]{memoir}

\usepackage{ragged2e}
\usepackage{lipsum}

\begin{document}
\setlrmarginsandblock{2.53cm}{2.53cm}{*}%
\settypeblocksize{20cm}{10cm}{*}%
\sideparmargin{outer}%
\renewcommand{\sideparfont}{\footnotesize}%
\renewcommand{\sideparform}{\RaggedRight}
\setlength\marginparwidth{5.4cm}%
\setlength\marginparsep{0.6cm}%
\setlength{\parindent}{0pt}% no par indent
\checkandfixthelayout[nearest]%

\sidepar[]{\lipsum[2]}\lipsum[1]

Textwidth: \the\textwidth\newline
Linewidth: \the\linewidth
\end{document}


The above ends up looking like this:

  #  Margin |        Content         | |  Note  #|
#  2.5cm  |  <--   13.5cm   -->    | |  5.4cm #|


The above when run will print a textwidth of 284.0pt, but linewidth of 383.0pt. In this case there are approximately 28.425pt/cm, so the textwidth is 10cm, but linewidth is 13.47cm. This would seem to be a clue to the issue at hand, as the text appears (based on visual inspection) to be suspiciously about 3.5cm too large.

Running the above, the memoir class shall output something like the following to the LaTeX log:

Stock height and width: 794.96999pt by 614.295pt
Top and edge trims: 0pt and 0pt
Page height and width: 794.96999pt by 614.295pt
Text height and width: 563pt by 284pt
Spine and edge margins: 71.13188pt and 71.13188pt
Upper and lower margins: 124.64378pt and 107.3262pt
Footskip: 30pt
Columnsep and columnseprule: 10pt and 0pt
Marginparsep and marginparwidth: 17.07182pt and 170.71652pt
Sidecapsep and sidecapwidth: 7pt and 50pt
Sidebarhsep and sidebarwidth: 7pt and 50pt
Sidebarvsep and sidebartopsep: 14.5pt and 0pt
Sidebarheight: 546.64995pt
Sidefoothsep and sidefootwidth: 7pt and 50pt
Sidefootvsep and sidefootheight: 14.5pt and 546.64995pt


One would expect that running \settypeblocksize would change the size of the textblock, be it updating the textwidth, linewidth or otherwise. This is consistent with my understanding of the relationship of these variables - as explained here on tex.SE.

In any case, in this instance it would be quite helpful to understand

1. why the size of the textblock isn't being updated as expected;
2. why \linewidth differs from \textwidth in the amount it does; and
3. what one ought to be doing to set the appropriate width of a block of text to accommodate extra-large side-paragraphs as in the case here.
• Please use the appropriate memoir interface for setting the margin par size, if not used recent memoir will auto adjust the with of the margin par. – daleif Jun 24 '13 at 14:51
• Besides the margins etc belongs on the preamble not the document. – daleif Jun 24 '13 at 14:52
• also combining \setlrmarginsandblock and \settypeblocksize does not make sense. The ...andblock also sets the width of the text block – daleif Jun 24 '13 at 14:55

Does this work?

The rule in the side par is just to see if it provoked an overfull box. showlocs is used to illustrate the boundaries.

\documentclass[oneside,12pt]{memoir}
\settypeblocksize{20cm}{10cm}{*}%
\setlrmargins{2.5cm}**
\sideparmargin{outer}%
\setmarginnotes{0.6cm}{5.4cm}{1em}
\checkandfixthelayout[nearest]%
\renewcommand{\sideparfont}{\footnotesize}%
\renewcommand{\sideparform}{\RaggedRight}
\setlength{\parindent}{0pt}% no par indent
\usepackage{ragged2e}
\usepackage{lipsum}
\pagestyle{showlocs}
\begin{document}

\sidepar[]{\rule{5.4cm}{2mm}}\lipsum[1]

Textwidth: \the\textwidth\newline
Linewidth: \the\linewidth
\end{document}


memoir can almost do \newgeometry on its own. (Assuming single column)

\clearpage
% some new layout
\checkandfixthelayout
\makeatletter
\ch@ngetext
\makeatletter


Should to the trick. I don't know why \ch@ngetext wasn't included in \checkandfixthelayout. Perhaps I'll add it at some point (it is an internal component of the\changetext command)

• Yes - that's almost exactly what I had come up with while fiddling, based on your comments. Many thanks. – Brian M. Hunt Jun 24 '13 at 15:06
• It may be worth noting for any passer-by that part of the problem I had was that I am using the newgeometry package (which, although compatible with memoir, it does not seem to happily deliver the functionality of \newgeometry as one might hope). One has to specify the width as e.g. \newgeometry{width=10cm}. – Brian M. Hunt Jun 24 '13 at 15:10
• Erhm, there is no package on ctan named newgeometry – daleif Jun 25 '13 at 8:32
• sorry, you are right — I meant the newgeometry command of the geometry` package. – Brian M. Hunt Jun 25 '13 at 9:17