Changes

Jump to navigation Jump to search
143 bytes added ,  15:57, 11 June 2012
Improve presentation: true subheadings, and code no wider than 80-ish characters (horizontal scrollbars are the pits).
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 github.com: [https://github.com/andythomas/TeX-sidenotes TeX-sidenotes]. Many thanks to the mailing list for all the help with it.
'''prelude'''. ==== Prelude ====Load the module with the layout and the helper macros:
<texcode>
</texcode>
'''bibtex'''. ==== BibTeX ====The next lines set up the look of the citations and a file containing the sample references.
<texcode>
</texcode>
'''title ==== 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.
<texcode>
</texcode>
'''table ==== 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 changedby the caesar module. In this case, only chapters are shown in the toc.
<texcode>
</texcode>
'''list ==== 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.
<texcode>
</texcode>
'''chapter'''. ==== Chapter ====It is time for the first chapter. This in done in the usual way.
<texcode>
</texcode>
'''sidenote'''. ==== Sidenote ==== After some text, an annotation can be placed on the same page in the margin using the sidenote macro.
<texcode>
</texcode>
'''citations'''. ==== Citations ====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.
<texcode>
</texcode>
'''section'''. ==== Section ====The sections are also started the common way.
<texcode>
</texcode>
'''figures'''. ==== Figures ====There are 3 different macros to place figures in the document. The first option is a small figure in the margin.
<texcode>
<texcode>
\startplacefigure[ title={A larger rectangle in the main area of the text, i.e.\ it does not span into the margin.},
reference=fig2]
\externalfigure[dummy][textwidth]
<texcode>
\startplacefigure[ 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.}]
\externalfigure[dummy][fullwidth]
\stopplacefigure
</texcode>
'''tables'''. ==== Tables ==== The same options are available for placing tables. The first one is again a small one in the margin.
<texcode>
\startplacemargintable[ reference=table1, title={A couple of numbers in a table in the margin.}]
\starttable[|c|c|c|]
\NC A \NC B \NC C\NC\SR
<texcode>
\startplacetable[ reference=table2, title={A couple of numbers in a larger table. This table spans the usual text width.}]
\starttable[|c|c|c|c|c|c|c|c|]
\NC A \NC B \NC C \NC D \NC E \NC F \NC G \NC H \NC \SR
<texcode>
\startplacewidetable[ reference={table3}, title={Even more numbers in a big table are shown here. This table spans across the full page, text width plus margin.}]
\starttable[|c|c|c|c|c|c|c|c|c|c|c|c|]
\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 \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 0.22\NC 0.04 \NC 0.93 \NC 0.81 \NC \FR
\stoptable
\stopplacewidetable
</texcode>
'''fullwidth ==== 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.
<texcode>
\startfullwidth
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.
\stopfullwidth
</texcode>
'''margintext'''. ==== Margintext ====Also useful might be the usual macro to place a note in the margin, but this time without a mark in the text.
<texcode>
\margintext{It is also possible to put a remark in the margin without a corresponding mark in the text.}
</texcode>
'''references'''. ==== References ====Finally, the references are placed, also using the common macro, but only used references are printed.
<texcode>

Navigation menu