Sidenotes style

From ConTeXt wiki

Andy Thomas

I am writing a physics textbook in ConTeXt Mk IV and I would like to share the macros I collected in a module. It is based on the design of our recent PhD theses and might be useful as an example with a lot of sidenotes (text, figures, tables, references). The newest version of the module is hosted on TeX-sidenotes. Many thanks to the mailing list for all the help with it.


Load the module with the layout and the helper macros:


The next task is to set the main language of the manuscript. This is done the usual way.


To avoid the hassle of several files, a library to set up dummy figures is initialized.



The next lines set up the look of the citations and a file containing the sample references.


Title page

Now, the text starts and information about the book has to be added. The name of the author, the title and the publisher can be set to automatically generate the title page.

   author={Andy Thomas},
   publisher={Bielefeld University}]

Table of contents

An auto-generated table of contents (toc) is placed the usual way, the look of the toc and e.g. the chapter headings is changed by the caesar module. In this case, only chapters are shown in the toc.


List of tables

A list of all the tables can be placed as well. The placelist macro needs two parameters this time, all tables are supposed to be shown here.



It is time for the first chapter. This in done in the usual way.



After some text, an annotation can be placed on the same page in the margin using the sidenote macro.

\sidenote{All information is on the same page, no turning of pages is necessary.} 


Citations work in a similar manner and are also placed in the margin of the document. This is done with the sidecite macro. The macro allows two optional parameters besides the citekey. The values of left and right are placed directly in front of the reference and directly afterwards, respectively.

\sidecite[left={See e.g.\ }, right={ And other Tufte books.}][Tufte1990,Tufte2006]


The sections are also started the common way.



There are 3 different macros to place figures in the document. The first option is a small figure in the margin.

\startplacemarginfigure[ title={A small rectangle put in the margin.}, reference=fig1]

A larger figure can be put in the text with

  title={A larger rectangle in the main area of the
         text, i.e.\ it does not span into the margin.},

In case that an even wider figure is needed, the third option spans over the text as well as the margin area. No special macro is needed here, just the figure width is larger.

  title={An even larger rectangle. This is the widest figure 
         option. Both, the text as well as the margin width 
         are used for the diagram.}]


The same options are available for placing tables. The first one is again a small one in the margin.

  title={A couple of numbers in a table in the margin.}]
  \NC 0.50 \NC 0.47 \NC 0.48  \NC \FR

The next option is a table across the text width.

  title={A couple of numbers in a larger table. This table spans the 
         usual text width.}]
  \NC  A \NC  B \NC C \NC D \NC E \NC F \NC G \NC H \NC \SR
\NC 0.21	\NC 0.23 \NC 0.34 \NC 0.42 \NC 0.53 \NC 0.64 \NC 0.72	\NC 0.33 \NC\FR

And the last example show a table across the full page (textwidth plus margin). A special widefigure float is needed to get an appropriate caption width.

  title={Even more numbers in a big table are shown here. This table
         spans across the full page, text width plus margin.}]
  \NC  A \NC B \NC C \NC D \NC E \NC F 
  \NC G \NC H \NC I \NC J \NC K \NC \ L \NC 
  \NC 0.21 \NC 0.23 \NC 0.34 \NC 0.42 \NC 0.53 \NC 0.64 
  \NC 0.72 \NC 0.33 \NC 0.22\NC 0.04 \NC 0.93 \NC 0.81 \NC

Fullwidth text

Additionally, there is a start/stopfullwidth that allows to fill text across the full page as well. However, it does not necessary work across page breaks and might overlap with marginal material.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus 
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur 
dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer 
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque 
habitant morbi tristique senectus et netus et malesuada fames ac 
turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla 
et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus 
sit amet tortor gravida placerat. Integer sapien est, iaculis in, 
pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices 
bibendum. Aenean faucibus. 


Also useful might be the usual macro to place a note in the margin, but this time without a mark in the text.

\margintext{It is also possible to put a remark in the margin without a 
  corresponding mark in the text.}


Finally, the references are placed, also using the common macro, but only used references are printed.


The example ends here.