diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-17 01:03:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-17 01:03:49 +0000 |
commit | eb531211a9347605eb2e38bd483e0698f2f3c30b (patch) | |
tree | c29125d024d27dd4e788de455c1221641b42cc9a /Master/texmf-dist/doc/latex/memoir/memman.tex | |
parent | 80f8b8d7c5431f27d221b670d2fbb51f37cdbdff (diff) |
memoir v1.618033988 (16feb10)
git-svn-id: svn://tug.org/texlive/trunk@17061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/memoir/memman.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/memoir/memman.tex | 2230 |
1 files changed, 2104 insertions, 126 deletions
diff --git a/Master/texmf-dist/doc/latex/memoir/memman.tex b/Master/texmf-dist/doc/latex/memoir/memman.tex index e75fbf2f7f7..007f6f559a1 100644 --- a/Master/texmf-dist/doc/latex/memoir/memman.tex +++ b/Master/texmf-dist/doc/latex/memoir/memman.tex @@ -1,3 +1,5 @@ +%#% extstart input preamble.tex +% % memman.tex Memoir class user manual (Part II only) last updated 2009/09/07 % Author: Peter Wilson % Copyright 2001, 2002, 2003, 2004, 2008, 2009 Peter R. wilson @@ -5,6 +7,9 @@ \documentclass[10pt,letterpaper,extrafontsizes]{memoir} \listfiles \usepackage{comment} +\usepackage[nofancy]{svninfo} +\svnInfo $Id: memman.tex 178 2010-02-16 09:33:34Z daleif $ + % For (non-printing) notes \PWnote{date}{text} \newcommand{\PWnote}[2]{} @@ -43,7 +48,11 @@ %% end preamble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%#% extend + \begin{document} + +%#% extstart input intro.tex \tightlists %%%%\firmlists \midsloppy @@ -115,7 +124,7 @@ \setlength{\parindent}{0pt} \setlength{\parskip}{\baselineskip} %%\ttfamily -\textcopyright{} 2001 --- 2009 Peter R. Wilson \\ +\textcopyright{} 2001 --- 2010 Peter R. Wilson \\ All rights reserved The Herries Press, Normandy Park, WA. @@ -149,6 +158,7 @@ Ninth impression, with additions and corrections: & 8 July 2009 \\ Eighth edition: & August 2009 \\ \end{tabular} \end{center} +Last changed \svnInfoDate \endgroup @@ -217,6 +227,10 @@ Eighth edition: & August 2009 \\ \clearpage \listofegresults +%#% extend + + +%#% extstart include preface.tex %\chapter{Foreword} \chapter{Preface} @@ -1132,6 +1146,9 @@ been answered. \end{comment} +%#% extend + +%#% extstart include intro-8.tex \chapter{Introduction to the eighth edition} @@ -1811,7 +1828,8 @@ than correspond directly with the supporter, who might well be away for some considerable time and perhaps not notice your email after having returned to base. - +%#% extend +%#% extstart include terminology.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Terminology} @@ -1997,6 +2015,8 @@ like `starts with a quad space'. It is a length defined in terms of an em, often a quad is 1em. +%#% extend + \cleardoublepage \pagenumbering{arabic} @@ -2008,6 +2028,7 @@ an em, often a quad is 1em. %%%%%\part{Practice} \label{part:practice} %%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%#% extstart include start-off.tex \chapter{Starting off} \label{chap:starting} @@ -2603,9 +2624,12 @@ want to put \cmd{\raggedbottom} in the preamble\index{preamble}. If you use the \Lopt{ebook} option you may well also want to use the \Lopt{12pt} and \Lopt{oneside} options. +%#% extend \clearpage \pagestyle{ruled} + +%#% extstart include laying-out-page.tex \chapter{Laying out the page} \label{chap:layingpage} @@ -3483,6 +3507,7 @@ margins\index{margin!specifying size} surrounding the typeblock\index{typeblock!location}. \section{Headers, footers and marginal notes} +\label{sec:head-foot-marg} \index{header|(}\index{footer|(} A page may have two additional items, and usually has at least one of @@ -3960,7 +3985,7 @@ printing may be\footnote{At least for an HP 5SiMx LaserJet duplex printer.} % specify short side binding \special{!TeXDict begin <</Tumble true>> setpagedevice end} \end{lcode} - +%<< because of emacs ... \section{Example} \label{sec:pexamp} @@ -4334,8 +4359,9 @@ have to call \cmd{\checkandfixthelayout} for all the changes to take effect. +%#% extend - +%#% extstart include text-and-fonts.tex \chapter{Text and fonts} @@ -5423,8 +5449,8 @@ a single line of a paragraph somehow looks worse at the top of a page than at the bottom. If all else fails, the solution is either to live with the odd line or to reword the text. - - +%#% extend +%#% extstart include titles.tex \chapter{Titles} @@ -6246,9 +6272,13 @@ You will have to change one or more of these if the vertical spacings of footnotes\index{footnote} and thanks notes are meant to be different. - \index{thanks!styling|)} +%#% extend + +%#% extstart include abstracts.tex + + \chapter{Abstracts} @@ -6511,6 +6541,8 @@ optional argument of the \cmd{\twocolumn} command. In fact, \index{abstract!one column|)} +%#% extend +%#% extstart include document-divisions.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -6595,6 +6627,13 @@ per chapter\index{chapter}. The starred version of the command, makes no changes to the page numbering or the print style for the folios\index{folio}. +\LMnote{2010/01/23}{Added the following paragraph, just stating what + \cs{mainmatter} does, was not clear before.} +Please note that \cmd{\mainmatter} will not only change the folio +numbers to arabic and restart it at 1, it will also make sure it +starts at the next coming recto page. (Even when running under the +\texttt{openany} option). + \begin{syntax} \cmd{\backmatter} \\ @@ -6613,7 +6652,7 @@ captions\index{caption}, etc., will be numbered continuously. If you have other types of floats that might be used in the front- main- or backmatter, then you can change some internals to add these to be numbered in the same manner as we do with figures and -tables. They are defined as +tables. They are defined as \begin{lcode} \newcommand\@memfront@floats{% \counterwithout{figure}{chapter} @@ -7300,6 +7339,8 @@ command will not add \meta{title} to the \toc. internally the resulting commands use \cmd{\partmark} in case you wish to capture the \meta{title} to use in running headers. + + \section{Chapter headings} \index{heading!chapter|(} @@ -9373,6 +9414,8 @@ normal size by the time subsubsection heads are reached, or before. +%#% extend +%#% extstart include pagination-and-headers.tex \chapterstyle{demo3} @@ -9680,6 +9723,15 @@ the `title' as the argument's value. For example, the \cmd{\chapter} macro calls \cmd{\chaptermark} with the value of the title specified as being for the header. +Please remember that the macros listed in \tref{tab:markmacros} are +`provider' macros, i.e. they provide information for \cmd{\leftmark} +and \cmd{\rightmark} for you to use later on. To gain access to the +section title, you do \emph{not} use \cmd{\sectionmark} in the header +or footer. It is a macro that provides information, but you need to +use \cmd{\leftmark} or \cmd{\rightmark} to access depending on how you +have defined \cmd{\sectionmark}. + + \section{Making headers and footers} As mentioned, the class provides for left, center, and right slots in @@ -9900,6 +9952,7 @@ you are using the page style is used on chapter openings, then you could define the following in the preamble (\piif{ifdraftdoc} is provided by the class and is set \ptrue\ when the \Lopt{draft} option is used). +\label{ex:draft.pagestyle} \begin{lcode} \ifdraftdoc \makeevenfoot{plain}{}{\thepage}{\textit{Draft: \today}} @@ -10030,6 +10083,16 @@ argument within the generated \cs{mark(both/right)} macro. By using the \cs{(no)uppercaseheads} declarations you can control the uppercasing, or otherwise, of the mark texts. The default is \cmd{\uppercaseheads}. +\LMnote{2010/02/08}{added the following paragraph} +Note that if you want to use a predefined page style, but would like +to not use automatic uppercasing, then issue \cs{nouppercaseheads} and +reload the page style, for example with the default page style in \theclass\ +\begin{lcode} + \nouppercaseheads + \pagestyle{headings} +\end{lcode} + + The macro \cmd{\createmark}\marg{sec}\marg{marks}\marg{show}\marg{prefix}\marg{postix} defines the \verb?\<sec>mark? macro where \meta{sec} is a sectional division such as \texttt{part}, \texttt{chapter}, \texttt{section}, etc., @@ -10050,6 +10113,10 @@ is equivalent to, respectively \def\sectionmark#1{\markight{#1}} \end{lcode} +The difference between \cmd{\createmark} and \cmd{\createplainmark} is +that the former create a macro that takes an argument, whereas +\cmd{\createplainmark} does not. + Using these macros \Mname's current definition of \verb?\makepsmarks{headings}? is much simpler (it also leads to a @@ -10068,6 +10135,20 @@ the \cmd{\leftmark} and \cmd{\rightmark} instead of just the \createplainmark{glossary}{both}{\glossaryname}} \end{lcode} + +\LMnote{2010/02/08}{fixed typo} +When \Mname{} runs the marks part of page style, it does not zero out +old marks, i.e.\ if an old \cmd{\sectionmark} exist, it still exist +even if we do not change it. This is both a good and a bad thing. To help +users redefine these marks to doing nothing we provide +\begin{syntax} +\cmd{\clearplainmark}\marg{type}\\ +\cmd{\clearmark}\marg{type}\\ +\end{syntax} +The used types are the same as for \cmd{\createplainmark} and \cmd{\createmark}. + + + \PWnote{2009/07/30}{Added sections on Document title and Part title in headers} \subsubsection{Header with the document title} @@ -10511,6 +10592,47 @@ your own pagestyle using \cmd{\framepictextfoot} and the \pstyle{showlocs} code as a starting point. +\section{Other things to do with page styles} +\label{sec:other-things-do} + +Back on \pref{ex:draft.pagestyle} we presented a way of adding some +draft information. Here is a more advanced example of this. + +One interesting use for page styles is to provide extra information +below the footer. This might be some kind of copyright information. Or +if your document is under version control with a system like +Subversion, and you have all your chapter laying in seperate files, +then why not add information at the start of very chapter, specifying +who did the last change to this chapter at which time. See the +\texttt{svn-multi} package (\cite{svn-multi}) and the Prac\TeX{} +Journal article \cite{practex-2007-3-ms} by the same author. Then this +information can be added to the start of every chapter using something +like: +\begin{lcode} +\usepackage[filehooks]{svn-multi} +\makeatletter +% remember to define a darkgray color +\newcommand\addRevisionData{% + \begin{picture}(0,0)% + \put(0,-10){% + \tiny% + \expandafter\@ifmtarg\expandafter{\svnfiledate}{}{% + \textcolor{darkgray}{Chapter last updated + \svnfileyear/\svnfilemonth/\svnfileday + \enspace \svnfilehour:\svnfileminute\ (revision \svnfilerev)} + }% + }% + \end{picture}% +} +\makeatother +\makepagestyle{chapter} % make chapter a real pagestyle not just an alias +\makeoddfoot{chapter}{\addRevisionData}{\thepage}{} +\makeevenfoot{chapter}{\addRevisionData}{\thepage}{} +\end{lcode} + + +%#% extend +%#% extstart include paragraphs-and-lists.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -11693,6 +11815,9 @@ other environments. \index{list|)} +%#% extend + +%#% extstart include content-lists.tex %%%%%%%%%%%%%%%%%%%%%%%%%% @@ -13721,7 +13846,8 @@ this is to add \end{lcode} just before the material you would like to pull out of the part tree. - +%#% extend +%#% extstart include flosts-and-captions.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -16358,10 +16484,10 @@ footnote\index{footnote!text} text. \index{caption|)} +%#% extend - - +%#% extstart include rows-and-columns.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -18325,8 +18451,8 @@ illustrate these points. \index{tabular!automatic|)} \index{tabular!free|)} - - +%#% extend +%#% extstart include page-notes.tex \chapter{Page notes} \label{chap:mnotes} @@ -18441,6 +18567,7 @@ the separator. Its default definition is: \cmd{\feetabovefloat} \\ \cmd{\feetbelowfloat} \\ \end{syntax} +\label{interest:feetbelowfloat} \glossary(feetabovefloat)% {\cs{feetabovefloat}}% {Typeset footnotes above bottom floats (the default).} @@ -18821,7 +18948,7 @@ the text set as a block paragraph you can try: \begin{adjustwidth}{-5mm}{-5mm} \centering \caption{Some footnote text styles}\label{tab:fnstyle} -\begin{tabular}{ccp{0.5\textwidth}} \toprule +\begin{tabular}{cc>{\raggedright\arraybackslash}p{0.5\textwidth}} \toprule \lnc{\footmarkwidth} & \lnc{\footmarksep} & Comment \\ \midrule 1.8em & -1.8em & Flushleft, regular indented paragraph (the default) \\ 1.8em & 0em & Indented, block paragraph hung on the mark \\ @@ -18832,6 +18959,10 @@ the text set as a block paragraph you can try: %-1.8em & -1.8em & Regular indented paragraph, starting in the margin \\ %-1.8em & 0em & \\ -1.8em & 1.8em & Block paragraph, flushleft, mark in the margin \\ +\LMnote{2010/02/05}{added -1sp trick} +-1sp & 0em & Block paragraph, flushleft, mark in the margin but +flush against the text +\\ \bottomrule \end{tabular} \end{adjustwidth} @@ -19005,12 +19136,18 @@ and if you later want rules you can write: \section{Marginal notes} +\LMnote{2010/01/**}{added a reference back to \cs{setmarginnotes}} Some marginalia can also be considered to be kinds of floats. The class provides the standard margin notes\index{margin note} -via \cmd{\marginpar}. +via \cmd{\marginpar}. Remember that the width of the margin note, the +separation from the text, and the separation from one \cmd{\marginpar} +to another is controlled by \cmd{\setmarginnotes}, see +Section~\ref{sec:head-foot-marg} on +page~\pageref{sec:head-foot-marg}. \begin{syntax} \cmd{\marginpar}\oarg{left-text}\marg{text} \\ + \cmd{\marginparmargin}\marg{placement}\\ \cmd{\reversemarginpar} \\ \cmd{\normalmarginpar} \\ \end{syntax} @@ -19018,6 +19155,11 @@ via \cmd{\marginpar}. {\cs{marginpar}\oarg{left-text}\marg{text}}% {Puts \meta{text} into the margin; if given, \meta{left-text} will be used instead of \meta{text} for the left margin.} +\glossary(marginparmargin)% + {\cs{marginparmargin}\marg{placement}}% + {Provides a more textual + interface for the user to specify in which margin the margin note + should be placed.} \glossary(reversemarginpar)% {\cs{reversemarginpar}}% {Reverses the normal margins used by \cs{marginpar}.} @@ -19026,27 +19168,61 @@ via \cmd{\marginpar}. {Sets the normal margins used by \cs{marginpar}(the default).} Just as a reminder, the \cmd{\marginpar} macro puts \meta{text} into the margin alongside the typeblock --- the particular margin depends -on the document style and the particular page. Following the declaration -\cmd{\normalmarginpar}, which is the default, the selected -margin\index{margin note!specifying the margin} is: -\begin{itemize} - \item Two columns: the note appears in the margin next to the column. - \item Single column, two sided: the note apears in the outside margin - (left on verso pages and right on odd numbered pages). - \item Single column, one sided: the note appears in the right margin. -\end{itemize} -If the optional argument \meta{left-text} is given then this will be used for -the text\index{margin note!text for particular margin} if the note -appears in the left margin, otherwise \meta{text} -is used no matter which margin. The note text is typeset in a parbox. - - Following the \cmd{\reversemarginpar} declaration the default margins -are reversed. The placement is determined by the declaration in effect at the -end of the paragraph containing the \cmd{\marginpar} command. \ltx\ tries -to align the top line of the note with the line in the main text where -the command was given. However, if this would overlap a previous note it will -be moved\index{margin note!moved} down, and possibly below, the page; -a warning message is printed on the terminal if a note is moved. +on the document style and the particular page. + +\LMnote{2010/01/**}{explained why the need for the + \cs{marginparmargin} macro} +The interface for specifying which margin \cmd{\marginpar} (and +friends) write to, have long been quite cluttered, so we have in 2010 +adopted a more textual and natural interface. For \cmd{\marginpar} the +macro is named \cmd{\marginparmargin}\marg{placement} with possible +placements: \emph{left}, \emph{right}, \emph{outer}, and +\emph{inner}. The interpretation of which is explained in \fref{fig:xmargin}. +The default corresponds to \verb?\marginparmargin{outer}?. + + +\LMnote{2010/01/**}{instead of explaining the algorithm, each time the + algorithm is explaine donce and for all in a figure, then we can + simply refer to it} +\begin{figure}[htbp] + \centering + \begin{minipage}{0.9\linewidth} + \cs{Xmargin}\marg{placement} for possible placements: \emph{left}, + \emph{right}, \emph{outer}, and \emph{inner}\\ + \renewcommand\descriptionlabel[1]{\hspace\labelsep\normalfont\sffamily\bfseries #1} + \begin{description} + \small + \item[Two column document] If the note is placed in the first + column, to the left, otherwise to the right, irrespective the + document being one- or two-side and of the users choices +\item[One sided document] If user specified \emph{left}, notes are + placed to the left, otherwise to the right. +\item[Two sided document] depends on whether a recto or verso page: + \begin{description} + \item[Recto (odd) page] note is placed on the right if the user + specified \emph{right} or \emph{outer}, otherwise the note is + placed on the left. + \item[Verso (even) page] note is placed on the left if the user + specified \emph{left} or \emph{outer}, otherwise the note is + placed on the right. + \end{description} +\end{description} + \end{minipage} + \caption{Interpretation of the arguments to the \cs{Xmargin} + commands for specifying the side in which to place side note like + material. \texttt{X} here equals \texttt{marginpar}, + \texttt{sidepar}, \texttt{sidebar}, or \texttt{sidefoot}.} + \label{fig:xmargin} +\end{figure} + +\fancybreak{} + +\LMnote{2010/02/07}{Removed the explanation of the old interface for + specifying the margin the \cs{marginpar} should go to. The original + text is still available via subversion.} +The original convoluted methods of specifying the margin for +\cmd{\marginpar} is deprecated, although still supported; if you need +to know what they are then you can read all about them in \texttt{memoir.dtx}. Sometimes \ltx\ gets confused near a page break and a note just after a break may get put into the wrong\index{margin note!wrong margin} margin @@ -19064,8 +19240,13 @@ command is used will prevent this, at the cost of at least one additional specified via \cmd{\marginpar} is flexible so that adjacent notes are prevented from overlapping. +\LMnote{2010/01/**}{side note section extended with \cs{sidenotefont} + and \cs{sidenotemargin}} \begin{syntax} \cmd{\sidepar}\oarg{left}\marg{right} \\ +\cmd{\sideparmargin}\marg{placement}\\ +\cmd{\sideparfont}\\ +\cmd{\sideparform}\\ \lnc{\sideparvshift} \\ \end{syntax} \glossary(sidepar)% @@ -19074,13 +19255,24 @@ is flexible so that adjacent notes are prevented from overlapping. \glossary(sideparvshift)% {\cs{sideparvshift}}% {Move a \cs{sidepar} up/down by this amount.} +\glossary(sideparmargin)% +{\cs{sideparmargin}\marg{placement}}% +{Specify into which margin the \cs{sidepar} goes.} +\glossary(sideparfont)% +{\cs{siderparfont}}% +{The font which the \cs{sidepar}s are typeset.} +\glossary(sideparform) +{\cs{sideparform}}% +{Macro holding placement like \cs{raggedright} and such.} The \cmd{\sidepar} macro is similar to \cmd{\marginpar} except that it produces side notes\index{side note} that do not float --- they may overlap. -The same spacing is used for both \cmd{\marginpar} and \cmd{\sidepar}, namely -the lengths \lnc{\marginparsep} and \lnc{\marginparwidth}. +The same spacing is used for both \cmd{\marginpar} and \cmd{\sidepar}, +namely the lengths \lnc{\marginparsep} and \lnc{\marginparwidth}. See +\cmd{\setmarginnotes}, in Section~\ref{sec:head-foot-marg} on +page~\pageref{sec:head-foot-marg}. The length \lnc{\sideparvshift} can be used to make vertical @@ -19088,35 +19280,59 @@ adjustments\index{side note!adjust position} to the position of \cmd{\sidepar} notes. By default this is set to a value of 0pt which should align the top of the note with the text line. +The command \cmd{\sideparfont} is used to specify the font used for +the \cmd{\sidepar}, default is \cmd{\normalfont}\cmd{\normalsize}. + +\LMnote{2010/02/05}{added description of \cs{sideparform}} +While \cmd{\sideparfont} holds the font settings for the sidepar, the +local adjustment is kept in \cmd{\sideparform}, the default is +\begin{lcode} + \newcommand*{\sideparform}{% + \ifmemtortm\raggedright\else\raggedleft\fi} +\end{lcode} +Which is a special construction the makes the text go flush against the +text block on side specified via \cmd{\sideparmargin}. Since the +margin par area is usually quite narrow it might be an idea to use a +ragged setup which enables hyphenation. This can be achieved by +\begin{lcode} + \usepackage{ragged2e} + \newcommand*{\sideparform}{% + \ifmemtortm\RaggedRight\else\RaggedLeft\fi} +\end{lcode} + + +\LMnote{2010/01/**}{Fixed the typo, such that it IS now stated that + the default is left, not right as was earlier stated} +The macro \cmd{\sideparmargin}\marg{placement} can be used to specify +which margin the side note should go to. \meta{placement} should be +one of \emph{left}, \emph{right}, \emph{outer}, or +\emph{inner}. Interpretation of which is explained in +\fref{fig:xmargin}. For some now forgotten reason the default +corresponds to \verb?\sideparmargin{left}?.\footnote{As not to change + existing documents, we have decided to leave it like that.} + + By default the \meta{right} argument is put in the -right\index{side note!text for particular margin} margin. When +%right +left% +\index{side note!text for particular margin} margin. When the \Lopt{twoside} option is used the \meta{right} argument is put into -the left margin on the verso (even numbered) pages; however, for these pages +the %left +right +margin on the verso (even numbered) pages; however, for these pages the optional \meta{left} argument is used instead if it is present. For two column text the relevent argument is put into the `outer' margin with respect to the column. -\begin{syntax} -\cmd{\sideparswitchtrue} \cmd{\sideparswitchfalse} \\ -\cmd{\reversesidepartrue} \cmd{\reversesideparfalse} \\ -\end{syntax} -\glossary(ifsideparswitch)% - {\cs{ifsideparswitch}}% - {Depending on the class one/two side option specifies the margin for - \cs{sidepar}s.} -\glossary(ifreversesidepar)% - {\cs{ifreversesidepar}}% - {If TRUE, reverses the margin for \cs{sidepar}s.} - The default placement can be -changed\index{side note!specifying the margin} by judicious use of the -\cs{sideparswitch...} and \cs{reversidepar...} declarations. For two sided -documents the default is \cmd{\sideparswitchtrue}, which specifies that -notes should be put into the outer margins; in one sided documents -the default is \cmd{\sideparswitchfalse} which specifies that notes -should always be put into the right hand margin. Following the -declaration \cmd{\reversesidepartrue} notes are put into opposite margin -than that described above -(the default declaration is \cmd{\reversesideparfalse}). +\fancybreak{} + +\LMnote{2010/02/07}{Removed the explanation of the old interface for + specifying the margin the \cs{sidepar} should go to. The original + text is still available via subversion.} The original convoluted +methods of specifying the margin for \cmd{\sidepar} is deprecated, +although still supported; if you need to know what they are then you +can read all about them in \texttt{memoir.dtx}. + \begin{syntax} \cmd{\parnopar} \\ @@ -19141,44 +19357,10 @@ in the prior paragraph with no line break). You can use \cmd{\parnopar} to make TeX to do its page break calculation when you want it to, by splitting what appears to be one paragraph into two paragraphs. +\LMnote{2010/02/09}{Moved the veelo example to the new sniplet chapter} Bastiaan Veelo\index{Veelo, Bastiaan} has kindly provided example code -for another form of a side note, as follows. -\begin{lcode} -%% A new command that allows you to note down ideas or annotations in -%% the margin of the draft. If you are printing on a stock that is wider -%% than the final page width, we will go to some length to utilise the -%% paper that would otherwise be trimmed away, assuming you will not be -%% trimming the draft. These notes will not be printed when we are not -%% in draft mode. -\makeatletter - \ifdraftdoc - \newlength{\draftnotewidth} - \newlength{\draftnotesignwidth} - \newcommand{\draftnote}[1]{\@bsphack% - {%% do not interfere with settings for other marginal notes - \strictpagecheck% - \checkoddpage% - \setlength{\draftnotewidth}{\foremargin}% - \addtolength{\draftnotewidth}{\trimedge}% - \addtolength{\draftnotewidth}{-3\marginparsep}% - \ifoddpage - \setlength{\marginparwidth}{\draftnotewidth}% - \marginpar{\flushleft\textbf{\textit{\HUGE !\ }}\small #1}% - \else - \settowidth{\draftnotesignwidth}{\textbf{\textit{\HUGE\ !}}}% - \addtolength{\draftnotewidth}{-\draftnotesignwidth}% - \marginpar{\raggedleft\makebox[0pt][r]{%% hack around - \parbox[t]{\draftnotewidth}{%%%%%%%%% funny behaviour - \raggedleft\small\hspace{0pt}#1% - }}\textbf{\textit{\HUGE\ !}}% - }% - \fi - }\@esphack} - \else - \newcommand{\draftnote}[1]{\@bsphack\@esphack} - \fi -\makeatother -\end{lcode} +for another form of a side note, the code is shown in +\snipletref{snip:veelo}. Bastiaan also noted that it provided an example of using the \lnc{\foremargin} length. @@ -19209,23 +19391,22 @@ later pages if it is too long to go on a single page. If multiple \cmd{\sidebar} commands are used on a page, the several \meta{text}s are set one after the other. +\LMnote{2010/02/07}{dropped \cs{ifsidebaroneside} as it is not used anymore} \begin{syntax} -\piif{ifsidebaroneside} \\ \cmd{\sidebarmargin}\marg{margin} \\ \end{syntax} -\glossary(ifsidebaroneside)% - {\cs{ifsidebaroneside}}% - {If \ptrue\ then sidebars are set in the right margin.} \glossary(sidebarmargin)% {\cs{sidebarmargin}\marg{margin}}% {Specifies the \meta{margin}(s) for sidebars.} - On two column pages sidebars\index{sidebar!location} are put in the -margin next to the column. On one column pages sidebars are put into -the right hand margin when \piif{ifsidebaroneside} is \ptrue. When it -is \pfalse\ the margin is controlled by the \cmd{\sidebarmargin}, the -argument to which may be \texttt{left}, \texttt{right}, \texttt{inner} -or \texttt{outer} with the obvious meanings (\verb?\sidebarmargin{right}? -and \verb?\sidebarmargintrue? are equivalent). + +\LMnote{2010/02/07}{just adapted the explanation from the other + \cs{Xmargin} macros} +The macro \cmd{\sidebarmargin}\marg{placement} can be used to specify +which margin the side note should go to. \meta{placement} should be +one of \emph{left}, \emph{right}, \emph{outer}, or +\emph{inner}. Interpretation of which is explained in +\fref{fig:xmargin}. The default corresponds to \verb?\sidebarmargin{outer}?. + \begin{syntax} \cmd{\sidebarfont} \cmd{\sidebarform} \\ @@ -19239,23 +19420,42 @@ and \verb?\sidebarmargintrue? are equivalent). The sidebar \meta{text} is typeset using the \cmd{\sidebarfont}, whose initial definition is \begin{lcode} -\newcommand{\sidebarfont}{\normalfont} +\newcommand{\sidebarfont}{\normalsize\normalfont} \end{lcode} Sidebars\index{sidebar!styling} are normally narrow so the text is set raggedright\index{raggedright} to reduce hyphenation\index{hyphenation} problems and stop items in environments like \Ie{itemize} from overflowing. +\LMnote{2010/02/05}{added description of \cs{sidebarform}} +\LMnote{2010/02/06}{fixed typo} More accurately, the text is set according to \cmd{\sidebarform} which is defined as: \begin{lcode} -\newcommand{\sidebarform}{\rightskip=\z@ \@plus 2em} + \newcommand*{\sidebarform}{% + \ifmemtortm\raggedright\else\raggedleft\fi} \end{lcode} -which is ragged right but with less raggedness than \cmd{\raggedright} -would allow. As usual, you can change \cmd{\sidebarform}, for example: +Which is a special construction the makes the text go flush against the +text block on side specified via \cmd{\sideparmargin}. Since the +margin par area is usually quite narrow it might be an idea to use a +ragged setup which enables hyphenation. This can be achieved by \begin{lcode} -\renewcommand{\sidebarform}{} % justified text + \usepackage{ragged2e} + \newcommand*{\sidebarform}{% + \ifmemtortm\RaggedRight\else\RaggedLeft\fi} \end{lcode} + + +% which is ragged right but with less raggedness than \cmd{\raggedright} +% would allow. As usual, you can change \cmd{\sidebarform}, for example: +% \begin{lcode} +% \renewcommand{\sidebarform}{} % justified text +% \end{lcode} + + + + + You may run into problems if the \cmd{\sidebar} command comes near a pagebreak, or if the sidebar text gets typeset alongside main text that has non-uniform line spacing (like around a \cmd{\section}). Further, @@ -19335,11 +19535,11 @@ The \cmd{\setsidebars} command can be used to set the sidebar parameters. is set to \meta{topsep}, \cmd{\sidebarfont} is set to \meta{font}, and finally \cmd{\setsidebarheight} is used to set the height to \meta{height}. The default is: +\LMnote{2010/02/07}{the default was wrong compared to the class} \begin{lcode} -\setsidebars{\marginparsep}{\marginparwidth}{2\onelineskip}% - {0pt}{}{\textheight} +\setsidebars{\marginparsep}{\marginparwidth}{\onelineskip}% + {0pt}{\normalsize\normalfont}{\textheight} \end{lcode} -The empty \meta{font} argument means that the normal body font will be used. Any, or all, of the arguments can be a \verb?*?, in which case the parameter corresponding to that argument is unchanged. Repeating the above example of changing the topskip and the height, assuming that the other defaults are @@ -19373,20 +19573,217 @@ comes below the float or the chapter title. I have been unable to eliminate this `feature'. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% start membook +\section{Side footnotes} +\label{sec:side-footnotes} + +Besides three already mentioned macros for writing in the margin +(\cmd{\marginpar}, \cmd{\sidepar}, and \cmd{\sidebar}) \theclass\ also +provide a functionality to add side footnotes. Actually two ways: one +is to internally make \cmd{\footnote} use \cmd{\marginpar} to write +in the margin, the other is to collect all side footnotes bottom up in +the margin. +\begin{syntax} + \cmd{\footnotesatfoot}\\ + \cmd{\footnotesinmargin}\\ +\end{syntax} +\cmd{\footnotesatfoot} (the default) causes \cmd{\footnote} to place +its text at the bottom of the page. By issuing \cmd{footnotesinmargin} +\cmd{\footnote} (and friends like \cmd{\footnotetext})will internally +use \cmd{\marginpar} to write the footnote to the page. + + + +\subsection{Bottom aligned side footnotes} +\label{sec:bottom-aligned-side} + +Bottom aligned footnotes works just like regular footnotes, just with +a separate macro \cmd{\sidefootenote}\marg{text}, and here the side +footnotes are placed at the bottom of the specified margin (more or +like as if one had taken the footnotes from the bottom of the page and +moved it to the margin instead). All the major functionality is the +same as for the normal \cmd{\footnote} +command.\footnote{\cs{sidefootnote} does not make sense inside + minipages\dots} +\begin{syntax} + \cmd{\sidefootnote}\oarg{num}\marg{text}\\ + \cmd{\sidefootnotemark}\oarg{num}\\ + \cmd{\sidefootnotetext}\oarg{num}\marg{text}\\ +\end{syntax} + +By default the regular footnotes and the side footnotes use different +counters. If one would like them to use the same counter, issue the +following in the preamble: +\begin{lcode} + \letcountercounter{sidefootnote}{footnote} +\end{lcode} + + +\subsection{Setting the layout for + \texorpdfstring{\cs{sidefootnote}}{sidefootnote}} +\label{sec:sett-layo-texorpdfst} + + + +There are several possibilities to change the appearance of the +\cmd{\sidefootnote}: + +Specifying the margin in which the side footnote should go, is done by +\begin{syntax} + \cmd{\sidefootmargin}\marg{keyword}\\ +\end{syntax} +where \meta{keyword} can be \emph{left}, \emph{right}, \emph{outer}, and +\emph{inner}, and their meaning is explained in +\fref{fig:xmargin}. The default is \emph{outer}. + +\begin{syntax} + \lnc{\sidefoothsep}\\ + \lnc{\sidefootwidth}\\ + \lnc{\sidefootvsep}\\ +\end{syntax} +\cmd{\sidefoothsep} is a length controlling the separation from the +text to the side footnote column, default +\cmd{\marginparsep}. \cmd{\sidefootwidth} is length controlling the +width of the side footnote column, default \cmd{\marginparwidth}, and +\cmd{\sidefootvsep} is the vertical distance between two side +footnotes, default \cmd{\onelineskip}. + +\begin{syntax} + \lnc{\sidefootadjust}\\ + \cmd{\setsidefootheight}\marg{height}\\ + \cmd{\sidefootfont}\\ +\end{syntax} +\cmd{\sidefootadjust} is a length which specifies the placement of the +side footnote column in relation to the bottom of the text block, the +default is 0pt. \cmd{\setsidefootheight} sets the maximal height of +the side footnote column, default \cmd{textwidth}. Lastly +\cmd{\sidefootfont} holds the general font setting for the side +footnote,\footnote{There is a similar macro to control the font of the + text alone.} default \verb?\normalfont\footnotesize?. + + +The macro +\begin{syntax} + \cmd{\setsidefeet}\marg{hsep}\marg{width}\marg{vsep}\marg{adj}\marg{font}\marg{height}\\ +\end{syntax} +sets the specifications all six settings above in one go.. An `*' +means `use the current value'. So \theclass\ internally use the +following default +\begin{lcode} + \setsidefeet{\marginparsep}{\marginparwidth}% + {\onelineskip}{0pt}% + {\normalfont\footnotesize}{\textheight}% +\end{lcode} +It is recommended to use this macro along with the other macros in the +preamble to specify document layout. + +\subsection{Styling + \texorpdfstring{\cs{sidefootnote}}{sidefootnote}} + + +\begin{syntax} + \cmd{\sidefootmarkstyle}\marg{code}\\ +\end{syntax} +controls how the side footnote counter is typeset in the side +footnote. The default is +\begin{lcode} + \sidefootmarkstyle{\textsuperscript{#1}} +\end{lcode} + +The mark is typeset in a box of width \lnc{\sidefootmarkwidth} +If this is negative, the mark is outdented +into the margin, if zero the mark is flush left, and when positive +the mark is indented. The mark is followed by the +text\index{side footnote!text} of the footnote. Second and later lines of the +text are offset by the length \lnc{\sidefootmarksep} from the end of the box. +The first line of a paragraph within a footnote is indented by +\lnc{\sidefootparindent}. The default values for these lengths are: +\begin{lcode} + \setlength{\sidefootmarkwidth}{0em} + \setlength{\sidefootmarksep}{0em} + \setlength{\sidefootparindent}{1em} +\end{lcode} + + +\fancybreak{} + +Caveat: It is natural to specify a length as \lnc{\sidefootparindent} +as a \LaTeX\ length, but it has a down side. If, as we do here, set +the value to 1em, then since the size of the em unit changes with the +current font size, one will actually end up with an indent +corresponding to the font size being used when the +\begin{lcode} + \setlength{\sidefootparindent}{1em} +\end{lcode} +was issued, not when it has used (where the font size most often will +be \cmd{\footnotesize}). + +At this point we consider this to be a \emph{feature} not an +error. One way to get pass this problem it the following +\begin{lcode} +\begingroup% keep font change local +\sidefoottextfont +\global\setlength\sidefootparindent{1em} +\endgroup +\end{lcode} +Then it will store the value of em corresponding to the font being +used. + + +\LMnote{2010/02/07}{explained the rest, left the side footnote hook + out of it for now} +\begin{syntax} + \cmd{\sidefoottextfont}\\ +\end{syntax} +holds the font being used by the side footnote, default +\verb+\normalfont\footnotesize+. +\begin{syntax} + \cmd{\sidefootform}\\ +\end{syntax} +is used to specify the raggedness of the text. Default +\begin{lcode} + \newcommand*{\sidefootform}{\rightskip=\z@ \@plus 2em} +\end{lcode} +which is much like \cs{raggedright} but allows some hyphenation. One +might consider using +\begin{lcode} + \usepackage{ragged2e} + \newcommand*{\sidefootform}{\RaggedRight} +\end{lcode} +Which does something similar. +\subsection{Side footnote example} +\label{sec:side-footn-example} + + + +In the margin you will find the result of the following code: +\begin{verbatim} + Testing\sidefootnote{This is test} bottom aligned + footnotes.\sidefootnote{This is another side + footnote, spanning several lines. + + And several paragraphs}\sidefootnote{And number three} +\end{verbatim} + Testing\sidefootnote{This is test} bottom aligned + footnotes.\sidefootnote{This is another side + footnote, spanning several lines. + + And several paragraphs}\sidefootnote{And number three} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% start membook +%#% extend @@ -19394,6 +19791,8 @@ this `feature'. +%#% extstart include decorative-text.tex + %%%%% end membook @@ -19839,6 +20238,9 @@ for epigraphs after the title (or the equivalents for \cmd{\book} pages). \index{epigraph|)} +%#% extend +%#% extstart include poetry.tex + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\clearpage @@ -20991,12 +21393,16 @@ and the result is shown on the next page. \index{verse|)} +%#% extend +%#% extstart include boxes-verbatims-and-files.tex + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%% membook %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\chapter{Boxes, verbatims and files} \label{chap:bvf} +\chapter{Boxes, verbatims and files} \label{chap:bvf}\label{chap:boxes} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The title of this chapter indicates that it deals with three @@ -22949,8 +23355,8 @@ in the text must be \cmd{\protect}ed.\index{protect} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% mbook - - +%#% extend +%#% extstart include cross-referencing.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Cross referencing} \label{chap:xref} @@ -23309,6 +23715,10 @@ will require the use of \cmd{\titleref} and so the declaration \index{reference!by name|)} + +%#% extend +%#% extstart include backmatter.tex + \chapter{\prBackmatter} \label{chap:backmatter} The \pixbackmatter\ consists of reference and supportive elements for @@ -25505,7 +25915,8 @@ has the opposite effect. In either conversion the optional argument will be ignored as for \cmd{\pagenote} it can be arbitrary text whereas for \cmd{\footnote} it must be a number. - +%#% extend +%#% extstart include miscellaneous.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\clearpage @@ -25772,6 +26183,7 @@ color. See \fref{fig:trimmarks}. \begin{figure}[htbp] \centering + \ifpdf% \subbottom[\cs{trimXmarks} (default)]{\includegraphics[page=1,scale=0.5]{trims-example}} \qquad\qquad @@ -25780,6 +26192,10 @@ color. See \fref{fig:trimmarks}. \subbottom[\cs{trimFrame}]{\includegraphics[page=3,scale=0.5]{trims-example}} \qquad\qquad \subbottom[\cs{quarkmarks}]{\includegraphics[page=4,scale=0.5]{trims-example}} + \else% + \texttt{examples only inserted in pdf-mode, now we can write and + work in DVI-mode, /daleif} + \fi% \caption{The four trimmark types} \label{fig:trimmarks} \end{figure} @@ -26020,6 +26436,31 @@ between the two styles. The current value of \Pcn{ctr} is unaffected by these commands. If you want to change the value use \cmd{\setcounter}, and to change the typesetting style use \cmd{\renewcommand} on \cs{thectr}. +\LMnote{2010/01/30}{Added \cs{letcountercounter}} +\begin{syntax} + \cmd{\letcountercounter}\marg{counterA}\marg{counterB}\\ + \cmd{\unletcounter}\marg{counterA}\\ +\end{syntax} +At times it is handy to `let' one counter act as if it was a +different counter. Say you have two constructions, each with their +own counter A and B, now you want them to cooperate, counting in +unison. This can be done using the \verb?\letcountercounter?. + +\cs{letcountercounter}\marg{counterA}\marg{counterB} \cs{let}s +(make the same) \meta{counterA} to \meta{counterB}. The +original of \meta{counterA} is kept, such that you can unlet it later. + +\cs{unletcounter}\marg{counterA} restores \meta{counterA} to its un\cs{let} +condition. + +This feature can be quite handy. Say for instance you want figures and +tables to counter within the same counter (say table), then we need +each change to the \verb?figure? counter to actually act on the +\verb?table? counter. \verb?\letcountercounter{figure}{table}? solves +the problem. + + + \section{New new and provide commands} \begin{syntax} @@ -26375,7 +26816,7 @@ to the next odd numbered page. A likely example for the optional \meta{text} argument is \begin{lcode} -\cleartooddpage[\vspace*{\vfill}THIS PAGE LEFT BLANK\vspace*{\vfill}] +\cleartooddpage[\vspace*{\fill}THIS PAGE LEFT BLANK\vspace*{\fill}] \end{lcode} which will put `THIS PAGE LEFT BLANK' in the centre of any potential skipped (empty) even numbered page. @@ -27824,6 +28265,11 @@ The macro \cs{oarg}\marg{arg} prints \oarg{arg} for an optional argument. The macro \cs{parg}\marg{arg} prints \parg{arg} for a parenthesized argument. \PWnote{2009/07/27}{Added chapter `For package users'} + + +%#% extend +%#% extstart include for-package-users.tex + \chapter{For package users} \label{chap:packageusers} Many packages work just as well with \Pclass{memoir} as with any of the @@ -28043,7 +28489,8 @@ of the standard commands needs to be replaced. \makeatother - +%#% extend +%#% extstart include an-example-book-design.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -28530,6 +28977,9 @@ putting \end{lcode} in your document's preamble\index{preamble}. +%#% extend + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%% revert to the regular styles \clearpage @@ -28538,6 +28988,8 @@ in your document's preamble\index{preamble}. \headstyles{memman} \pagestyle{ruled} +%#% extstart include an-example-thesis-design.tex + \PWnote{2009/07/05}{Added thesis design chapter} \PWnote{2009/07/08}{Revised thesis design chapter} \chapter{An example thesis design} \label{chap:thesis} @@ -29546,6 +29998,7 @@ title as the recto header. The page numbers are in the footers by the foredge margin. Altogether, a much more appealing production than Archibald Smythe University will permit. +%#% extend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% appendices @@ -29557,6 +30010,8 @@ than Archibald Smythe University will permit. %%\chapterstyle{section} %%\chapterstyle{demo3} +%#% extstart include packages-and-maros.tex + \chapter{Packages and macros} The \Mname\ class does not provide for everything that you @@ -29783,6 +30238,1470 @@ serves my needs. \end{comment} +%#% extend +%#% extstart include sniplets.tex + + +\LMnote{2010/02/09}{Started the sniplet chapter} +\chapter{Sniplets} +\label{cha:sniplets} + +This chapter is (over time) meant to hold various pieces of code for +\theclass\ that we have gathered over the years or others have +contributed, and which we think might be useful for others. + +If you have some \theclass\ related code you would like to share feel +free to send it to \verb?daleif+memoir@imf.au.dk?. + + +\begin{sniplet}\label{snip:1} + The \theclass\ class is not quite compatible with the \Lpack{crop} + package. This is usually not a problem as we provide our own + crop marks. But \Lpack{crop} provide one feature that we do not: + mirroring of the output. The following sniplet was posted on + \textsc{ctt} by Heiko Oberdiek (2009/12/05, thread \textit{ + Memoir and mirrored pdf output }) + \begin{lcode} + \usepackage{atbegshi} + \usepackage{graphicx} + \AtBeginShipout{% + \sbox\AtBeginShipoutBox{% + \kern-1in\relax + \reflectbox{% + \rlap{\kern1in\copy\AtBeginShipoutBox}% + \kern\stockwidth + }% + }% + } + \end{lcode} +\end{sniplet} + +\begin{sniplet}\label{snip:2} + Memoir counts all the pages used. You can use this information + in various ways. For example, say you are preparing a setup to write + small assignments in, these may or may not be just one page. How do + we remove the footer automatically if there is only one page? + + Easy, place the following in the preamble (compile at least twice): + \begin{lcode} + \AtEndDocument{\ifnum\value{lastsheet}=1\thispagestyle{empty}\fi} + \end{lcode} +\end{sniplet} + +\begin{sniplet}\label{snip:veelo} + Bastiaan Veelo\index{Veelo, Bastiaan} has kindly provided example code + for another form of a side note, as follows. +\begin{lcode} +%% A new command that allows you to note down ideas or annotations in +%% the margin of the draft. If you are printing on a stock that is wider +%% than the final page width, we will go to some length to utilise the +%% paper that would otherwise be trimmed away, assuming you will not be +%% trimming the draft. These notes will not be printed when we are not +%% in draft mode. +\makeatletter + \ifdraftdoc + \newlength{\draftnotewidth} + \newlength{\draftnotesignwidth} + \newcommand{\draftnote}[1]{\@bsphack% + {%% do not interfere with settings for other marginal notes + \strictpagecheck% + \checkoddpage% + \setlength{\draftnotewidth}{\foremargin}% + \addtolength{\draftnotewidth}{\trimedge}% + \addtolength{\draftnotewidth}{-3\marginparsep}% + \ifoddpage + \setlength{\marginparwidth}{\draftnotewidth}% + \marginpar{\flushleft\textbf{\textit{\HUGE !\ }}\small #1}% + \else + \settowidth{\draftnotesignwidth}{\textbf{\textit{\HUGE\ !}}}% + \addtolength{\draftnotewidth}{-\draftnotesignwidth}% + \marginpar{\raggedleft\makebox[0pt][r]{%% hack around + \parbox[t]{\draftnotewidth}{%%%%%%%%% funny behaviour + \raggedleft\small\hspace{0pt}#1% + }}\textbf{\textit{\HUGE\ !}}% + }% + \fi + }\@esphack} + \else + \newcommand{\draftnote}[1]{\@bsphack\@esphack} + \fi +\makeatother +\end{lcode} +Bastiaan also noted that it provided an example of using the +\lnc{\foremargin} length. If you want to try it out, either put the +code in your preamble, or put it into a package (i.e., \file{.sty} +file) without the \cs{makeat...} commands. +\end{sniplet} + + + +%#% extend +%#% extstart include pictures.tex + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LMnote{2010/02/08}{Added this entire chapter from PW sources} + + +\chapter{Pictures} \label{chap:lpic} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\LMnote{2010/02/08}{Added this intro to show the motivation for adding +this} +There are make freely available \LaTeX\ introductions on CTAN and +other places. One thing that these apparently are not covering is the +traditional picture environment. It can be very handy in many +applications, though for more complex drawings the reader might be +better of with TiKz/pgf or PSTricks. For the benefit of the general +reader we here provide a lesson in the standard picture environment. + +\LMnote{2010/02/08}{Added a writers note as not to change the text too +much, the most important thing about this note is the mentioning of +the picture package by Heiko, which enables us to use something like +\cs{put}(5mm, 5cm)} +\emph{Writers comment:} There are many extensions to the stock picture +environment provided by the \LaTeX\ kernel. We have chosen not to deal +with them in this chapter but instead concentrate on what you get as +is from the kernel. But there are a few handy packages that the reader +might want to explore: picture (by Heiko Oberdiek) which extends the +\cs{put} syntax to include arbitrary lengths, like 50mm; pict2e which +is mentioned in \cite{GCOMPANION} but just recently was released; +eepic. All packages are available from CTAN. + + + +\fancybreak{} + + + This chapter describes how to draw diagrams\index{diagram} and +pictures\index{picture} using \ltx. +Pictures are drawn in the \Ie{picture} environment. You can draw\index{draw} +straight +lines, arrows and circles; you can also put text into your pictures. + + Most often pictures are drawn within a \Ie{figure}\index{figure} +environment, but +they may also be drawn as part of the normal text. + + + + +\section{Basic principles} + + The positions of picture elements are specified in terms of a +two-dimensional cartesian coordinate\index{coordinate system} system. +A \emph{coordinate}\index{coordinate} is a +number, such as \texttt{7}, \texttt{-21} or \texttt{1.78}. In the cartesian coordinate +system, a pair of coordinates (i.e., a pair of numbers) specifies a +position relative to the position designated as \texttt{(0,0)}. This special +position is called the \emph{origin}. +The first of the coordinate pair\index{coordinate pair} +gives the value of the horizontal distance from the origin to the position. +A positive coordinate is an offset to the right and a negative number is +an offset to the left. The first value of a coordinate pair is called the +\emph{x coordinate}\index{coordinate}. +The second value of a coordinate pair is called the +\emph{y coordinate}\index{coordinate} +and gives the vertical offset from the origin (positive +upwards and negative downwards). + +\begin{syntax} +\lnc{\unitlength} \\ +\end{syntax} +\glossary(unitlength) +{\cs{unitlength}}{The unit of length in a picture environment. Default 1pt.} + To draw a picture we also need to specify the units of measurement. +By default, \ltx\ takes the printer's point (there are 72.27 points to +an inch) as the measurement of length. The value of the unit of +length\index{unit length} measurement +within a \Ie{picture} environment is actually given by the value +of the \lnc{\unitlength} length declaration. + This can be changed +to any length that you like via the \cmd{\setlength} command. For example, \\ +\verb?\setlength{\unitlength}{2mm}? \\ +will make the value of \lnc{\unitlength} to be two millimeters. + + Figure~\ref{flpic:coords} shows the positions of some points and their +coordinate values. Coordinate pairs are typed as a pair of numbers, separated +by a comma, and enclosed in parentheses. + +\begin{figure} +\setlength{\unitlength}{1mm} +\centering +\begin{picture}(80,70) + \thicklines +% x axis + \put(10,30){\begin{picture}(60,10) + \thicklines \put(-5,0){\vector(1,0){65}} + \thinlines \multiput(0,0)(10,0){6}{\line(0,1){3}} + \put(0,-3){\makebox(0,0)[t]{-20}} + \put(10,-3){\makebox(0,0)[t]{-10}} + \put(23,-3){\makebox(0,0)[t]{0}} + \put(30,-3){\makebox(0,0)[t]{10}} + \put(40,-3){\makebox(0,0)[t]{20}} + \put(50,-3){\makebox(0,0)[t]{30}} + \put(63,0){\makebox(0,0){x}} + \end{picture}} +% y axis + \put(30,10){\begin{picture}(10,60) + \thicklines \put(0,-5){\vector(0,1){60}} + \thinlines \multiput(0,0)(0,10){6}{\line(1,0){3}} + \put(-3,0){\makebox(0,0)[r]{-20}} + \put(-3,10){\makebox(0,0)[r]{-10}} + \put(-3,30){\makebox(0,0)[r]{10}} + \put(-3,40){\makebox(0,0)[r]{20}} + \put(-3,50){\makebox(0,0)[r]{30}} + \put(0,58){\makebox(0,0)[b]{y}} + \end{picture}} + + \put(50,50){\begin{picture}(10,10) + \put(0,0){\circle*{1}} + \put(2,2){\makebox(0,0)[bl]{\texttt{(20,20)}}} + \end{picture}} + + \put(15,45){\begin{picture}(10,10) + \put(0,0){\circle*{1}} + \put(-2,2){\makebox(0,0)[br]{\texttt{(-15,15)}}} + \end{picture}} + + \put(15,20){\begin{picture}(10,10) + \put(0,0){\circle*{1}} + \put(-2,-2){\makebox(0,0)[tr]{\texttt{(-15,-10)}}} + \end{picture}} + + \put(40,20){\begin{picture}(10,10) + \put(0,0){\circle*{1}} + \put(2,-2){\makebox(0,0)[tl]{\texttt{(10,-10)}}} + \end{picture}} + + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Some points in the cartesian coordinate system} +\label{flpic:coords} +\end{figure} + + +\begin{syntax} +\cmd{\thinlines} \\ +\cmd{\thicklines} \\ +\cmd{\linethickness}\marg{len} \\ +\end{syntax} +\glossary(thinlines) +{\cs{thinlines}}{Picture declaration for lines to be thin.} +\glossary(thicklines) +{\cs{thicklines}}{Picture declaration for lines to be thick.} +\glossary(linethickness) +{\cs{linethickness}\marg{len}}{Picture declaration for vertical and + horizontal lines to be \meta{len} thick.} + + In general, \ltx\ can draw lines of only two +thicknesses\indextwo{thickness}{line}, +thin and thick. The required +thickness is specified via either a \cmd{\thicklines} or a \cmd{\thinlines} +declaration, with the latter being the default. + +There is another declaration, \cmd{\linethickness}, which can be used +to change the thickness of horizontal and vertical lines only. +It sets the thickness of these lines to \meta{len}, but has no effect on +any sloping lines. + + A \Ie{picture} environment has a required size pair argument that +specifies the width and height of the picture, in terms of the value +of \cmd{\unitlength}. +\begin{syntax} +\senv{picture}\parg{width, height} +\meta{contents} +\eenv{picture} \\ +\senv{picture}\parg{width, height}\parg{llx, lly} +\meta{contents} +\eenv{picture} \\ +\end{syntax} +\glossary(picture) +{\senv{picture}\parg{width, height}}{Creates a box of \meta{width} times + \meta{height} (in terms of \cs{unitlength}) in which you can use drawing + commands. The origin is at (0,0).} +\glossary(picturex) +{\senv{picture}\parg{width, height}\parg{llx,lly}}{Creates a box of \meta{width} times + \meta{height} (in terms of \cs{unitlength}) in which you can use drawing + commands. The origin is at (\meta{llx},\meta{lly}).} + The environment creates a box\indextwo{box}{picture} +of size \meta{width} by \meta{height}, which will not be +split\index{box!unbreakable} across pages. The default position of +the origin in this environment is at the lower left hand corner of the box. +For example, +\begin{lcode} +\begin{picture}(80,160) +\end{lcode} +creates a picture box of width 80 and height 160 whose lower left hand corner +is at \texttt{(0,0)}. There is also an optional coordinate pair argument (which +comes after the required argument) that specifies the coordinates of the +lower left hand corner of the box if you do not want the default origin. +\begin{lcode} +\begin{picture}(80,160)(10,20) +\end{lcode} +specifies a picture box of width 80 and height 160, as before, but with +the bottom left hand corner having coordinates of \texttt{(10,20)}. Thus, the +top right hand corner will have coordinates \texttt{(90,180)}. Note that the +optional argument is enclosed in parentheses not square brackets as is +ordinarily the case. Typically, the optional argument is used when you +want to shift everything in the picture. \ltx\ uses the required argument +to determine the space required for typesetting the result. + + You are not limited to drawing within the box, but if you do draw +outside the box the result might run into other text on the page, or even +run off the page altogether. \ltx\ only reserves the space you specify +for the picture and does not know if anything protrudes. In particular +\begin{lcode} +\begin{picture}(0,0) +\end{lcode} +creates a zero-sized\index{picture!zero-sized} picture which takes no +space at all. This can be very useful if you need to position +things on the page. + + + Within the \Ie{picture} environment, \ltx\ is in a special \emph{picture} +mode\indextwo{mode}{picture} (which is a restriced form of LR +mode\indextwo{mode}{LR}). +The only commands that can appear in picture mode are are \cmd{\put}, +\cmd{\multiput} and \cmd{\qbezier} commands, and a few +declarations such as the type style and the thickness declarations. +By the way, +you should only change the value of \cmd{\unitlength} outside +picture mode\indextwo{mode}{picture} +otherwise \ltx\ will get confused about its measurements. + +\section{Picture objects} + + In a picture everything is placed and drawn by the \cmd{\put} (or +its \cmd{\multiput} variant) command. +\begin{syntax} +\cmd{\put}\parg{x, y}\marg{object} \\ +\end{syntax} +\glossary(put) +{\cs{put}\parg{x,y}\marg{object}}{Drawing command to place \meta{object} +at coordinates (\meta{x,y}). In the simplest case \meta{object} +is just text.} +\cmd{\put} places \meta{object} in the picture with the +object's \emph{reference point}\index{reference point} + at position \parg{x, y}. + + The following sections describe the various picture +objects\index{picture object}. + +\subsection{Text} + + Text\index{picture object!text} is the simplest kind of picture object. +This is typeset in LR mode\indextwo{mode}{LR} and the +reference point\index{reference point!text} is at +the lower left hand corner of the text. +\begin{egsource}{eg:pic1} +\setlength{\unitlength}{1mm} % measurements in millimeters +\begin{picture}(30,10) % define size of picture +\put(0,0){\framebox(30,10){}} % draw frame around picture +\put(10,5){Some text} % place text +\thicklines +\put(10,5){\vector(1,1){0}} % mark reference point +\end{picture} +\setlength{\unitlength}{1pt} % reset measurements to default +\end{egsource} + +\begin{egresult}[Picture: text]{eg:pic1} +\vspace*{0.5\onelineskip} +\setlength{\unitlength}{1mm} +\begin{picture}(30,10) +\put(0,0){\framebox(30,10){}} +\put(10,5){Some text} +\thicklines +\put(10,5){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + In the diagram, and those following, +the reference point is indicated by an arrow. Also, a +box is drawn round the diagram at the same size as the \Ie{picture} +environment. + +\subsection{Boxes} \label{slpic:boxes} + + A box\index{picture object!box} picture object is made with one of +the box\index{box} commands. When used +in picture mode\indextwo{mode}{picture}, the box commands have a slightly +different form than when +in normal text. The first argument of a box command is a size pair +that specifies the width and height of the box. The last argument is the +text to be placed in the box. The reference point\indextwo{reference point}{box} +of a box is the lower left hand corner. +\begin{syntax} +\cmd{\framebox}\parg{width, height}\oarg{pos}\marg{text} \\ +\cmd{\makebox}\parg{width, height}\oarg{pos}\marg{text} \\ +\end{syntax} +\glossary(framebox) +{\cs{framebox}\parg{width,height}\oarg{pos}\marg{text}}{A picture +object framing \meta{text} (at position \meta{pos}) in a box \meta{width} +by \meta{height}.} +\glossary(makebox) +{\cs{makebox}\parg{width,height}\oarg{pos}\marg{text}}{A picture +object putting \meta{text} (at position \meta{pos}) in a box \meta{width} +by \meta{height}.} + The \cmd{\framebox} command draws a +framed box\indextwo{box}{framed}\index{picture object!framed box} +of the specified \parg{width, height} dimensions around +the text. + +\begin{egsource}{eg:pic2} +\setlength{\unitlength}{1pc} +\begin{picture}(22,5) +\put(0,0){\framebox(22,5){}} % empty box +\thicklines +\put(2,1){\framebox(5,2.5){center}} % centered text +\put(2,1){\vector(1,1){0}} % ref point +\put(9,1){\framebox(5,2)[b]{bottom}} % bottomed text +\put(9,1){\vector(1,1){0}} % ref point +\put(16,1){\framebox(5,3)[tl]{top left}} % cornered text +\put(16,1){\vector(1,1){0}} % ref point +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: text in boxes]{eg:pic2} +\vspace*{0.5\onelineskip} +\setlength{\unitlength}{1pc} +\begin{picture}(22,5) +\put(0,0){\framebox(22,5){}} +\thicklines +\put(2,1){\framebox(5,2.5){center}} +\put(2,1){\vector(1,1){0}} +\put(9,1){\framebox(5,2)[b]{bottom}} +\put(9,1){\vector(1,1){0}} +\put(16,1){\framebox(5,3)[tl]{top left}} +\put(16,1){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + The default position\index{picture object!framed box!text position} +of the \textit{text} is centered in the box. +However, this can +be changed via an optional argument (which is enclosed in square brackets), +placed between the coordinate pair and the text argument. This argument +consists of either one or two of the following letters. +\begin{itemize} +\item[\pixposarg{l}] (left) Places the contents at the left of the box. +\item[\pixposarg{r}] (right) Places the contents at the right of the box. +\item[\pixposarg{t}] (top) Places the contents at the top of the box. +\item[\pixposarg{b}] (bottom) Places the contents at the bottom of the box. +\end{itemize} +These place the text in the corresponding position in the box. In a two-letter +argument the order of the letters is immaterial. For example, \verb?[tr]? +and \verb?[rt]? will both result in the text being placed at the top right +hand corner of the box. Unlike the normal \cmd{\framebox} command, a +\cmd{\framebox} in a \Ie{picture} environment does not add any extra space +around the text. + + Corresponding to the \cmd{\framebox} there is a \cmd{\makebox} +command\index{picture object!unframed box} which +does not draw a frame around its contents. The \cmd{\makebox} command takes the +same arguments as the \cmd{\framebox}. Particularly interesting is when you +specify a zero sized\index{picture object!unframed box!zero size} +\cmd{\makebox}. A \verb?\makebox(0,0){text}? +command will make the reference point the center of \texttt{text}. Similarly, +the other positioning arguments\index{picture object!unframed box!text position} +which will adjust the reference point with respect to +the box contents. This can be used for fine-tuning the position of text +in a picture. + +\begin{egsource}{eg:pic3} +\setlength{\unitlength}{1pc} +\begin{picture}(16,2) +\put(0,0){\framebox(16,2){}} +\thicklines +\put(3.5,1){\makebox(0,0){center}} % ref at text center +\put(3.5,1){\vector(0,-1){0}} +\put(7,1){\makebox(0,0)[b]{bottom}} % ref at text bottom +\put(7,1){\vector(0,1){0}} +\put(11,1){\makebox(0,0)[tl]{top left}} % ref at text top left +\put(11,1){\vector(1,-1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: positioning text]{eg:pic3} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1pc} +\begin{picture}(16,2) +\put(0,0){\framebox(16,2){}} +\thicklines +\put(3.5,1){\makebox(0,0){center}} +\put(3.5,1){\vector(0,-1){0}} +\put(7,1){\makebox(0,0)[b]{bottom}} +\put(7,1){\vector(0,1){0}} +\put(11,1){\makebox(0,0)[tl]{top left}} +\put(11,1){\vector(1,-1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + You can draw a dashed box\index{picture object!dashed box} +with the \cmd{\dashbox} command. +\begin{syntax} +\cmd{\dashbox}\marg{len}\parg{width, height}\oarg{pos}\marg{text} \\ +\end{syntax} +\glossary(dashbox) +{\cs{dashbox}\marg{len}\parg{width,height}\oarg{pos}\marg{text}}{A picture +object framing \meta{text} (at position \meta{pos}) in a dashed box +\meta{width} by \meta{height}. The dashes and spaces are each \meta{len} long.} + The first argument +of this command specifies the length of each dash. The following arguments +are the same as for the other box commands. + +\begin{egsource}{eg:pic4} +\setlength{\unitlength}{4mm} +\begin{picture}(7,4) +\put(0,0){\framebox(7,4){}} +\thicklines +\put(1,1){\dashbox{0.5}(5,2)[tr]{top right}} +\put(1,1){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: dashed box]{eg:pic4} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{4mm} +\begin{picture}(7,4) +\put(0,0){\framebox(7,4){}} +\thicklines +\put(1,1){\dashbox{0.5}(5,2)[tr]{top right}} +\put(1,1){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + The appearance of the box is best when the width and height of the +box are integer multiples of the dash length. In the example the dash length +has been set to \texttt{0.5} with the width and height set as \texttt{(5,2)}; thus +the width and height are respectively ten and four times the dash length. + + The \cmd{\frame}\index{picture object!frame} command draws a +frame around the contents of the +box that exactly fits the contents. +\begin{syntax} +\cmd{\frame}\marg{contents} \\ +\end{syntax} +\glossary(frame) +{\cs{frame}\marg{contents}}{A picture object drawing a frame about \meta{contents}.} +It takes a single required argument +which is the contents. + +\begin{egsource}{eg:pic6} +\setlength{\unitlength}{1pc} +\begin{picture}(10,3) +\put(0,0){\framebox(10,3){}} +\thicklines +\put(0.5,2){\frame{$\mathcal{FRAME}$ text}} +\put(0.5,2){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: framing]{eg:pic6} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1pc} +\begin{picture}(10,3) +\put(0,0){\framebox(10,3){}} +\thicklines +\put(0.5,2){\frame{$\mathcal{FRAME}$ text}} +\put(0.5,2){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + + The \cmd{\shortstack} command\index{picture object!stack} +enables you to stack\index{stacking!text} text vertically. It +produces a box with a single column of text. As with the other boxes, the +reference point\indextwo{reference point}{stack} is at the lower left hand corner, +although no frame is +drawn around the stack. The \cmd{\shortstack} command is an ordinary +box making command, but it is not often used outside picture +mode\indextwo{mode}{picture}. +\begin{syntax} +\cmd{\shortstack}\oarg{pos}\marg{text} \\ +\end{syntax} +\glossary(shortstack) +{\cs{shortstack}\oarg{pos}\marg{text}}{Vertically stacks each line of +\meta{text} into a column, normally centered but can be left or + right aligned via \meta{pos}. Usually used as a picture object, +but can be used outside the environment.} + Each line of \meta{text}, except for the last, is +ended\indextwo{end}{line} by a \cmd{\\} command. +The default is to center each text line within the column. However, there +is an optional positioning argument. + A value of \pixposarg{l} for \meta{pos} will left align the +text and a value of \pixposarg{r} will right align the text. + +\begin{egsource}{eg:pic7} +\setlength{\unitlength}{1mm} +\begin{picture}(75,25) +\put(0,0){\framebox(75,25){}} +\put(3,3){\shortstack{Default \\ short \\ Stack}} +\put(3,3){\vector(1,1){0}} +\put(23,3){\shortstack[l]{Left\\aligned\\short\\Stack}} +\put(23,3){\vector(1,1){0}} +\put(43,3){\shortstack[r]{Right\\aligned\\short\\Stack}} +\put(43,3){\vector(1,1){0}} +\put(63,3){\shortstack{Extra \\[4ex] spaced \\[2ex] Stack}} +\put(63,3){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: stacking]{eg:pic7} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1mm} +\begin{picture}(75,25) +\put(0,0){\framebox(75,25){}} +\put(3,3){\shortstack{Default \\ short \\ Stack}} +\put(3,3){\vector(1,1){0}} + +\put(23,3){\shortstack[l]{Left\\aligned\\short\\Stack}} +\put(23,3){\vector(1,1){0}} + +\put(43,3){\shortstack[r]{Right\\aligned\\short\\Stack}} +\put(43,3){\vector(1,1){0}} + +\put(63,3){\shortstack{Extra \\[4ex] spaced \\[2ex] Stack}} +\put(63,3){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + The rows in a stack\index{stacking!text!vertical spacing} +are not evenly spaced. The spacing between two +rows can be changed in one of two ways. +\begin{enumerate} +\item Add a strut to a row. A strut\index{strut} is a vertical rule with + no width. +\item Use the optional argument to the \cmd{\\} command. This optional + argument is a length value. + \begin{syntax} + \cmd{\\}\oarg{len} \\ + \end{syntax} + It has the effect of adding additional \meta{len} + vertical space between the two lines that the \cmd{\\} separates. +\end{enumerate} + +\begin{syntax} +\cmd{\newsavebox}\marg{box} \\ +\cmd{\savebox}\marg{box}\parg{width, height}\oarg{pos}\marg{text} \\ +\cmd{\sbox}\marg{box}\marg{text} \\ +\cmd{\usebox}\marg{box} \\ +\end{syntax} +\glossary(savebox) +{\cs{savebox}\meta{box}\parg{width, height}\oarg{pos}\marg{text}}{Picture + command to save + \meta{text} in a (pre-existing) storage box \meta{box} making it + size \meta{width} times \meta{height}. The optional + argument controls the position of the \meta{text}.} + + Just as in normal text you can save and reuse boxes. +The \cmd{\savebox}\index{box!saved object} +macro in picture mode\indextwo{mode}{picture} is a variant of the normal +text version, but the other three commands are in same in both +picture\indextwo{mode}{picture} and paragraph\indextwo{mode}{paragraph} modes, +and are described in \Cref{chap:boxes}. In picture mode you have to +specify the size of the storage box when saving it, via the +\parg{width, height} argument to \cmd{\savebox}. + + A \cmd{\savebox} command can be used within a picture to store a picture +object. The first argument of \cmd{\savebox} is the name of the +storage bin to be used. The following arguments are the same as the +\cmd{\makebox} command. +The result is stored, not drawn. When you have saved +something it can be drawn in either the same or other pictures via the +\cmd{\usebox}\index{box!using saved object} command. +This command takes one argument, which is the name +of the storage bin. + +\begin{egsource}{eg:pic8} +\setlength{\unitlength}{1pc} +\begin{picture}(18,5) +\put(0,0){\framebox(18,5){}} +\newsavebox{\Mybox} +\savebox{\Mybox}(6,3)[tr]{$\mathcal{SAVED}$} +\thicklines +\put(1,1){\frame{\usebox{\Mybox}}} +\put(11,1){\frame{\usebox{\Mybox}}} +\put(1,1){\vector(1,1){0}} +\put(11,1){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: saved boxes]{eg:pic8} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1pc} +\begin{picture}(18,5) +\put(0,0){\framebox(18,5){}} +\newsavebox{\Mybox} +\savebox{\Mybox}(6,3)[tr]{$\mathcal{SAVED}$} +\thicklines +\put(1,1){\frame{\usebox{\Mybox}}} +\put(11,1){\frame{\usebox{\Mybox}}} +\put(1,1){\vector(1,1){0}} +\put(11,1){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + It can take \ltx\ a long time to draw something. When a box is saved +it actually contains the typeset contents, which then just get +printed out when the box is +used. It can save processing time if something which appears several times +is saved and then used as and where required. On the other hand, a saved +box can use up a significant amount of \ltx's internal storage space. +The \cmd{\sbox} command with an empty text argument can be used to delete +the contents of a bin. For example, +\begin{lcode} +\sbox{\Mybox}{} +\end{lcode} +will empty the \verb?\Mybox? box. Note that this does not delete the +storage box itself. + +\subsection{Lines} + + \ltx\ can draw straight +lines\index{picture object!line|seealso{line}}\index{line|seealso{picture object}}, +but the range of slopes\index{line!restricted slope} for lines is +somewhat restricted. Further, very short lines\index{line!short} cannot +be drawn. +\begin{syntax} +\cmd{\line}\parg{i, j}\marg{distance} \\ +\end{syntax} +\glossary(line) +{\cs{line}\parg{dx,dy}\marg{distance}}{Picture object of a line, slope + \meta{dx,dy} and coordinate length \meta{distance}.} +The pair \parg{i, j} specifies the +\emph{slope}\index{slope}\indextwo{line}{slope} of the line, and \meta{distance} +is a value that controls the length\index{line!length} of the line. The line +starts at its reference point\indextwo{reference point}{line} +(i.e., the place where it is \cmd{\put}). +The slope\index{slope} of the line is such that if a point on the line is slid along the +line, then for every $i$ units the point moves in the horizontal direction +it will also have moved $j$ units in the vertical direction. Negative +values for $i$ or $j$ have the expected meaning. A move of -3 units in $i$ +means a move of 3 units to the left, and similarly a move of -4 units in +$j$ means a move of 4 units downwards. So, a line sloping up to the right +will have positive values for $i$ and $j$, while a line sloping up to the +left will have a negative value for $i$ and a positive value for $j$. + + The \meta{distance} argument specifies the length of the line in the +$x$ (horizontal) direction. One problem with this may have occured to you: +what if the line is vertical (i.e., $i=0$)? In this case only, \meta{distance} +specifies the vertical length of the line. The \meta{distance} argument must +be a non-negative value. For horizontal and vertical lines only, the actual +length of the line is \meta{distance}. Figure~\ref{flpic:spec}, which is +produced from the code below, diagrams the line +specification arguments. + +\begin{lcode} +\begin{figure} +\centering +\setlength{\unitlength}{1mm} +\begin{picture}(70,60) +\thicklines % draw line and ref point + \put(10,20){\line(2,1){40}} + \put(10,20){\vector(1,-1){0}} +\thinlines % draw axes + \put(0,0){\vector(1,0){60}} \put(63,0){x} + \put(0,0){\vector(0,1){50}} \put(0,53){y} + % draw i and j vectors + \put(20,25){\vector(1,0){20}} + \put(30,22){\makebox(0,0)[t]{$i$}} + \put(40,25){\vector(0,1){10}} + \put(42,30){\makebox(0,0)[l]{$j$}} + % draw distance vector + \put(30,10){\vector(-1,0){20}} + \put(30,10){\vector(1,0){20}} + \put(30,8){\makebox(0,0)[t]{\textit{distance}}} +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Specification of a line or arrow} +\label{flpic:spec} +\end{figure} +\end{lcode} + +\begin{figure} +\centering +\setlength{\unitlength}{1mm} +\begin{picture}(70,60) +\thicklines + \put(10,20){\line(2,1){40}} + \put(10,20){\vector(1,-1){0}} +\thinlines + \put(0,0){\vector(1,0){60}} \put(63,0){x} + \put(0,0){\vector(0,1){50}} \put(0,53){y} + + \put(20,25){\vector(1,0){20}} \put(30,22){\makebox(0,0)[t]{$i$}} + \put(40,25){\vector(0,1){10}} \put(42,30){\makebox(0,0)[l]{$j$}} + + \put(30,10){\vector(-1,0){20}} + \put(30,10){\vector(1,0){20}} + \put(30,8){\makebox(0,0)[t]{\textit{distance}}} + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Specification of a line or arrow} +\label{flpic:spec} +\end{figure} + + Only a fixed number of slopes\index{line!restricted slope} +are available. This is because \ltx\ uses +a special font for drawing lines --- a line actually consists of little bits +of angled rules joined together. Thus, there is only a limited number of +values for $i$ and $j$. They must both be integers and in the range +$-6 \leq i,j \leq 6$. Also, they must have no common divisor other than 1. +In other words, the ratio between $i$ and $j$ must be in its simplest form. +You cannot, for example, have $(3,6)$; instead it would have to be $(1,2)$. +The shortest line that \ltx\ can draw is about ten points +(1/7 inch approximately) in overall length. You can, though, draw lines that +are too long to fit on the page. + + Figure~\ref{flpic:lslope} shows the the lines and arrows slanting +upwards and to the right that can be drawn in \ltx. The slope $(i,j)$ +pair are shown to the right of the first set of lines and arrows, together +with the $j/i$ ratio which gives the slope of the line as a decimal number. + + +\subsection{Arrows} + + As shown in \fref{flpic:lslope} you can also draw a line with an +arrowhead\index{line!arrowhead|see{vector}}\index{arrow|see{vector}} +on it. These are specified +by the \cmd{\vector}\index{vector|seealso{picture object}}\index{picture object!vector|seealso{vector}} +command. +\begin{syntax} +\cmd{\vector}\parg{i, j}\marg{distance} \\ +\end{syntax} +\glossary(vector) +{\cs{vector}\parg{dx,dy}\marg{distance}}{Picture object of a line with an +arrowhead at the end, slope \meta{dx,dy} and coordinate +length \meta{distance}.} + This works exactly +like the \cmd{\line} command and the arrowhead is put on the line at the +end away from the reference point\indextwo{reference point}{vector}. +That is, the arrow points away from the +reference point. If the \meta{distance} argument is too small (zero, +for instance) the arrowhead only is drawn, with its point at the position +where it is \cmd{\put}. + +\begin{figure} +\centering +\setlength{\unitlength}{1mm} +\begin{picture}(70,70) +% lines and arrows with slopes <= (1,1) +\thicklines \put(0,0){\vector(1,0){50}} +\thinlines \put(0,0){\line(6,1){50}} + \put(0,0){\line(5,1){50}} +\thicklines \put(0,0){\vector(4,1){50}} + \put(0,0){\vector(3,1){50}} +\thinlines \put(0,0){\line(5,2){50}} +\thicklines \put(0,0){\vector(2,1){50}} +\thinlines \put(0,0){\line(5,3){50}} +\thicklines \put(0,0){\vector(3,2){50}} + \put(0,0){\vector(4,3){50}} +\thinlines \put(0,0){\line(5,4){50}} + \put(0,0){\line(6,5){50}} +\thicklines \put(0,0){\vector(1,1){50}} +% label vertically +\put(53,0){\begin{picture}(20,60) + \begin{footnotesize} + \put(0,0){$(1,0)=0$} + \put(0,7.333){$(6,1)=0.167$} + \put(0,10){$(5,1)=0.2$} + \put(0,12.5){$(4,1)=0.25$} + \put(0,16.667){$(3,1)=0.333$} + \put(0,20){$(5,2)=0.4$} + \put(0,25){$(2,1)= 0.5$} + \put(0,30){$(5,3)= 0.6$} + \put(0,33.333){$(3,2)=0.667$} + \put(0,37.5){$(4,3)=0.75$} + \put(0,40){$(5,4)=0.8$} + \put(0,42.667){$(6,5)=0.833$} + \put(0,50){$(1,1)=1$} + \end{footnotesize} + \end{picture}} +% remaining lines and arrows +\thinlines \put(0,0){\line(5,6){41.667}} + \put(0,0){\line(4,5){40}} +\thicklines \put(0,0){\vector(3,4){37.5}} + \put(0,0){\vector(2,3){33.333}} +\thinlines \put(0,0){\line(3,5){30}} +\thicklines \put(0,0){\vector(1,2){25}} +\thinlines \put(0,0){\line(2,5){20}} +\thicklines \put(0,0){\vector(1,3){16.667}} + \put(0,0){\vector(1,4){12.5}} +\thinlines \put(0,0){\line(1,5){10}} + \put(0,0){\line(1,6){8.333}} +\thicklines \put(0,0){\vector(0,1){50}} +% label horizontally +\put(0,55){\begin{picture}(50,10) + \begin{footnotesize} +% \put(41.667,5){\makebox(0,0){$(5,6)=1.2$}} +% \put(40,0){\makebox(0,0){$(4,5)=1.25$}} +% \put(37.5,5){\makebox(0,0){$(3,4)=1.333$}} +% \put(33.333,0){\makebox(0,0){$(2,3)=1.5$}} +% \put(30,5){\makebox(0,0){$(3,5)=1.667$}} + \put(25,0){\makebox(0,0){$(1,2)=2$}} +% \put(20,5){\makebox(0,0){$(2,5)=2.5$}} +% \put(16.667,0){\makebox(0,0){$(1,3)=3$}} +% \put(12.5,5){\makebox(0,0){$(1,4)=4$}} +% \put(10,0){\makebox(0,0){$(1,5)=5$}} +% \put(8.333,5){\makebox(0,0){$(1,6)=6$}} + \put(0,0){\makebox(0,0){$(0,1)= \infty$}} + \end{footnotesize} + \end{picture}} +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Sloping lines and arrows} \label{flpic:lslope} +\end{figure} + + \ltx\ is even more restrictive in the number of slopes that it can draw +with arrows\index{vector!restricted slope}\indextwo{slope}{vector} +than it is with lines. +The $(i,j)$ slope specification pair +must lie in the range $-4 \leq i,j \leq 4$. Also, as with the \cmd{\line} +command, they must have no common divisor. + + + +\subsection{Circles} + + \ltx\ can draw two kinds of circles\index{picture object!circle|seealso{circle}}\index{circle|seealso{picture object}}. +One is an open circle\index{circle!open} where only +the perimeter is drawn, and the other is a solidly filled +disk\index{circle!disk}\index{disk|see{circle}}. +\begin{syntax} +\cmd{\circle}\marg{diameter} \\ +\cmd{\circle*}\marg{diameter} \\ +\end{syntax} +\glossary(circle) +{\cs{circle}\marg{diam}}{Picture object of a open circle +diameter \meta{diam}.} +\glossary(circle*) +{\cs{circle*}\marg{diam}}{Picture object of a black closed circle +diameter \meta{diam}.} + + The reference point\indextwo{reference point}{circle} for the open circle, +drawn by the \cmd{\circle} +command, and the disk, which is drawn by the \cmd{\circle*} command, +is at the center +of the circle. The argument to the commands is the \meta{diameter} +of the circle. + +\begin{egsource}{eg:pic10} +\setlength{\unitlength}{1pt} +\begin{picture}(200,60) +\put(0,0){\framebox(200,60){}} +\put(30,30){\circle{40}} +\put(30,30){\vector(1,1){0}} +\put(150,50){\circle*{20}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: circles]{eg:pic10} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1pt} +\begin{picture}(200,60) +\put(0,0){\framebox(200,60){}} +\put(30,30){\circle{40}} +\put(30,30){\vector(1,1){0}} +\put(150,50){\circle*{20}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + Just as with the \cmd{\line} and \cmd{\vector} commands, there is only a +limited range of circles\index{circle!restricted diameter} that can be drawn. +Typically, the maximum diamter of a \cmd{\circle} is about 40 points, while +for a \cmd{\circle*} the maximum diameter is less, being about 15 points. +\ltx\ will choose +the nearest sized circle to the one that you specify. Either consult your +local guru to find what sized circles you can draw on your system, or +try some experiments by drawing a range of circles to see what happens. + +\subsubsection{Quarter circles and boxes} + + In \ltx\ an \cmd{\oval}\index{picture object!oval|seealso{box, rounded}}% +\index{oval|seealso{picture object}} is a rectangular +box\index{box!rounded|seealso{oval}} with rounded corners. +\begin{syntax} +\cmd{\oval}\parg{width, height}\oarg{portion} \\ +\end{syntax} +\glossary(oval) +{\cs{oval}\parg{width,height}\oarg{portion}}{Picture object of a rectangular +box, size \meta{width} by \meta{height}, with rounded corners. The optional +\meta{portion} argument controls whether and which a quarter or a half of +the object will be drawn (default is everything).} + + The \cmd{\oval} command has one required argument which specifies the +width and height of the box. The normally sharp corners of the box are +replaced by quarter circles of the maximum possible radius (which \ltx\ +figures out for itself). Unlike the boxes discussed earlier, the reference +point\indextwo{reference point}{oval} is at the `center' of the oval. + +\begin{egsource}{eg:pic11} +\setlength{\unitlength}{1mm} +\begin{picture}(75,20) +\thicklines +\put(0,0){\framebox(75,20){}} +\put(15,10){\oval(15,10)} % complete oval +\put(15,10){\vector(1,1){0}} +\put(30,10){\oval(5,5)} % small oval +\put(30,10){\vector(1,1){0}} +\put(45,10){\oval(15,10)[l]} % left half +\put(45,10){\vector(1,1){0}} +\put(60,10){\oval(15,10)[bl]} % bottom left quarter +\put(60,10){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: ovals]{eg:pic11} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1mm} +\begin{picture}(75,20) +\thicklines +\put(0,0){\framebox(75,20){}} +\put(15,10){\oval(15,10)} +\put(15,10){\vector(1,1){0}} + +\put(30,10){\oval(5,5)} +\put(30,10){\vector(1,1){0}} + +\put(45,10){\oval(15,10)[l]} +\put(45,10){\vector(1,1){0}} + +\put(60,10){\oval(15,10)[bl]} +\put(60,10){\vector(1,1){0}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + The \cmd{\oval} command also has one optional argument, \meta{portion}, +which comes after +the required argument. + Use of the optional argument enables either half\index{box!rounded!half} or +a quarter\index{box!rounded!quarter} of the complete rounded box +to be drawn. The argument is a one or two +letter code drawn from the following. +\begin{itemize} +\item[\pixposarg{l}] (left) Draw the left of the oval. +\item[\pixposarg{r}] (right) Draw the right of the oval. +\item[\pixposarg{t}] (top) Draw the top of the oval. +\item[\pixposarg{b}] (bottom) Draw the bottom of the oval. +\end{itemize} +These are similar to the optional positioning argument in the box commands. +A one letter code will draw the designated half of the oval, while a two letter +code results in the designated quarter of the oval being drawn. In all cases +the reference point is at the center of the `complete' oval. + + + +\begin{egsource}{eg:pic12} +\setlength{\unitlength}{1mm} +\begin{picture}(30,10) +\thicklines +\put(15,5){\oval(30,10)} +\put(15,5){\makebox(0,0){Text in oval}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: text in oval]{eg:pic12} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1mm} +\begin{picture}(30,10) +\thicklines +\put(15,5){\oval(30,10)} +\put(15,5){\makebox(0,0){Text in oval}} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + Unlike the boxes described in \Sref{slpic:boxes} there is no \meta{text} +argument for an \cmd{\oval}. If you want the rounded box to contain text, +then you have to place the text inside the box yourself. +The code in example~\ref{eg:pic12} shows +one way of doing this; a zero-sized box is used to center the text at +the center of the oval. + + +\section{Repetitions} + + The \cmd{\multiput} command is a convenient way to place regularly spaced +copies of an object\index{picture object!regular pattern} +in a picture. +\begin{syntax} +\cmd{\multiput}\parg{x, y}\parg{dx, dy}\marg{num}\marg{object} \\ +\end{syntax} +\glossary(multiput) +{\cs{multiput}\parg{x,y}\parg{dx,dy}\marg{num}\marg{object}}{Drawing +command to place \meta{num} copies of \meta{object}, starting at coordinates +\meta{x,y} and stepping \meta{dx,dy} for each copy after the first.} +As you can see, this is similar to the syntax for the \cmd{\put} command, +except that there are two more required arguments, namely \parg{dx, dy} +and \textit{num}. + + The \parg{dx, dy} argument is a pair of (decimal) numbers that +specify the amount that the \meta{object} shall be moved at each repetition. +The first of this pair specifies the horizontal movement and the second the +vertical movement. Positive values shift to the right or up, and negative +numbers shift to the left or down. The \meta{num} argument specifies how many +times the \meta{object} is to be drawn. + + The code below produces \fref{flpic:scales}. +This example +also shows that a \Ie{picture} can be placed +inside\index{picture object!picture} another \Ie{picture}. +Often it is useful to break a complex diagram up into pieces, with each +piece being a separate \Ie{picture}. The pieces can then be individually +positioned within the overall diagram. + +\begin{figure} +\setlength{\unitlength}{1pc} +\centering +%\begin{picture}(21,35) +\begin{picture}(21,26) +% Draw Pica scale +%\put(2,2){\begin{picture}(5,33) +\put(2,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Picas}}} +% \thicklines \put(0,0){\line(0,1){35}} + \thicklines \put(0,0){\line(0,1){24.0}} +% \thinlines \multiput(0,0)(0,1){36}{\line(1,0){1}} +% \multiput(0,0)(0,10){4}{\line(1,0){2}} + \thinlines \multiput(0,0)(0,1){25}{\line(1,0){1}} + \multiput(0,0)(0,10){3}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,10){\makebox(0,0)[br]{10}} + \put(-1,20){\makebox(0,0)[br]{20}} +% \put(-1,30){\makebox(0,0)[br]{30}} + \end{picture}} +% Draw Points scale +%\put(7,2){\begin{picture}(5,33) +\put(7,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Points}}} +% \thicklines \put(0,0){\line(0,1){35}} +% \thinlines \multiput(0,0)(0,0.8333){42}{\line(1,0){1}} +% \multiput(0,0)(0,8.333){5}{\line(1,0){2}} + \thicklines \put(0,0){\line(0,1){24.2}} + \thinlines \multiput(0,0)(0,0.8333){30}{\line(1,0){1}} + \multiput(0,0)(0,8.333){3}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,8.333){\makebox(0,0)[br]{100}} + \put(-1,16.667){\makebox(0,0)[br]{200}} +% \put(-1,25){\makebox(0,0)[br]{300}} +% \put(-1,33.333){\makebox(0,0)[br]{400}} + \end{picture}} +% Draw Millimeter scale +%\put(12,2){\begin{picture}(5,33) +\put(12,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Millimeters}}} +% \thicklines \put(0,0){\line(0,1){35}} +% \thinlines \multiput(0,0)(0,0.4742){74}{\line(1,0){1}} +% \multiput(0,0)(0,2.3711){15}{\line(1,0){2}} + \thicklines \put(0,0){\line(0,1){24.2}} + \thinlines \multiput(0,0)(0,0.4742){52}{\line(1,0){1}} + \multiput(0,0)(0,2.3711){11}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} +% \put(-1,2.371){\makebox(0,0)[br]{10}} + \put(-1,4.742){\makebox(0,0)[br]{20}} +% \put(-1,7.113){\makebox(0,0)[br]{30}} + \put(-1,9.484){\makebox(0,0)[br]{40}} +% \put(-1,11.855){\makebox(0,0)[br]{50}} + \put(-1,14,226){\makebox(0,0)[br]{60}} +% \put(-1,16.597){\makebox(0,0)[br]{70}} + \put(-1,18.968){\makebox(0,0)[br]{80}} +% \put(-1,21.339){\makebox(0,0)[br]{90}} + \put(-1,23.71){\makebox(0,0)[br]{100}} +% \put(-1,26.081){\makebox(0,0)[br]{110}} +% \put(-1,28.452){\makebox(0,0)[br]{120}} +% \put(-1,30.823){\makebox(0,0)[br]{130}} +% \put(-1,33.194){\makebox(0,0)[br]{140}} + \end{picture}} +% Draw Inch scale +%\put(17,2){\begin{picture}(5,33) +\put(17,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Inches}}} +% \thicklines \put(0,0){\line(0,1){35}} +% \thinlines \multiput(0,0)(0,0.60225){59}{\line(1,0){1}} +% \multiput(0,0)(0,6.0225){6}{\line(1,0){2}} + \thicklines \put(0,0){\line(0,1){24.1}} + \thinlines \multiput(0,0)(0,0.60225){41}{\line(1,0){1}} + \multiput(0,0)(0,6.0225){5}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,6.0225){\makebox(0,0)[br]{1}} + \put(-1,12.045){\makebox(0,0)[br]{2}} + \put(-1,18.0675){\makebox(0,0)[br]{3}} + \put(-1,24.09){\makebox(0,0)[br]{4}} +% \put(-1,30.1125){\makebox(0,0)[br]{5}} + \end{picture}} + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Some measuring scales} \label{flpic:scales} +\end{figure} + +\begin{lcode} +\begin{figure} +\setlength{\unitlength}{1pc} +\centering +\begin{picture}(21,26) +% Draw Pica scale +\put(2,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Picas}}} + \thicklines \put(0,0){\line(0,1){24.0}} + \thinlines \multiput(0,0)(0,1){25}{\line(1,0){1}} + \multiput(0,0)(0,10){3}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,10){\makebox(0,0)[br]{10}} + \put(-1,20){\makebox(0,0)[br]{20}} + \end{picture}} +% Draw Points scale +\put(7,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Points}}} + \thicklines \put(0,0){\line(0,1){24.2}} + \thinlines \multiput(0,0)(0,0.8333){30}{\line(1,0){1}} + \multiput(0,0)(0,8.333){3}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,8.333){\makebox(0,0)[br]{100}} + \put(-1,16.667){\makebox(0,0)[br]{200}} + \end{picture}} +% Draw Millimeter scale +\put(12,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Millimeters}}} + \thicklines \put(0,0){\line(0,1){24.2}} + \thinlines \multiput(0,0)(0,0.4742){15}{\line(1,0){1}} + \multiput(0,0)(0,2.3711){11}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,4.742){\makebox(0,0)[br]{20}} + \put(-1,9.484){\makebox(0,0)[br]{40}} + \put(-1,14,226){\makebox(0,0)[br]{60}} + \put(-1,18.968){\makebox(0,0)[br]{80}} + \put(-1,23.71){\makebox(0,0)[br]{100}} + \end{picture}} +% Draw Inch scale +\put(17,2){\begin{picture}(5,24) + \put(0,-0.5){\makebox(0,0)[t]{\textbf{Inches}}} + \thicklines \put(0,0){\line(0,1){24.1}} + \thinlines \multiput(0,0)(0,0.60225){41}{\line(1,0){1}} + \multiput(0,0)(0,6.0225){5}{\line(1,0){2}} + \put(-1,0){\makebox(0,0)[br]{0}} + \put(-1,6.0225){\makebox(0,0)[br]{1}} + \put(-1,12.045){\makebox(0,0)[br]{2}} + \put(-1,18.0675){\makebox(0,0)[br]{3}} + \put(-1,24.09){\makebox(0,0)[br]{4}} + \end{picture}} + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Some measuring scales} \label{flpic:scales} +\end{figure} +\end{lcode} + + + You can also make regular +two-dimensional\index{picture object!two-dimensional pattern} patterns +by using a +\cmd{\multiput} pattern inside another \cmd{\multiput}. As \ltx\ will +process each \cmd{\multiput} every time it is repeated it is often more +convenient to store the results of the first \cmd{\multiput} in a bin +and then use this as the argument to the second \cmd{\multiput}. + +\begin{egsource}{eg:pic14} +\setlength{\unitlength}{1mm} +\begin{picture}(32,14) +\put(0,0){\framebox(32,14){}} +\savebox{\Mybox}(8,8){\multiput(0,0)(4,4){3}{\circle*{1}}} +\multiput(4,4)(6,0){4}{\usebox{\Mybox}} +\sbox{\Mybox}{} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egsource} + +\begin{egresult}[Picture: repetitions]{eg:pic14} +\vspace{0.5\onelineskip} +\setlength{\unitlength}{1mm} +\begin{picture}(32,14) +\put(0,0){\framebox(32,14){}} +\savebox{\Mybox}(8,8){\multiput(0,0)(4,4){3}{\circle*{1}}} +\multiput(4,4)(6,0){4}{\usebox{\Mybox}} +\sbox{\Mybox}{} +\end{picture} +\setlength{\unitlength}{1pt} +\end{egresult} + + Remember that +a storage bin must have been declared via a \cmd{\newsavebox} command before +it can be used. I originally declared and used +the \cs{Mybox} bin in \Sref{slpic:boxes}. +As the above example shows, you can change the contents of a storage bin +by utilising it in another \cmd{\savebox}. Storage bins can use up a +lot of \ltx's memory. After +you have finished with a storage bin empty it via the \cmd{\sbox} +command with an empty last argument, as shown in the example. + +\section{Bezier curves} + + Standard \ltx\ provides one further drawing command --- +the \cmd{\qbezier}\index{picture object!Bezier curve|seealso{Bezier curve}} +command. +This can be used for drawing fairly arbitrary curves. +\begin{syntax} +\cmd{\qbezier}\oarg{num}\parg{Xs, Ys}\parg{Xm, Ym}\parg{Xe, Ye} \\ +\end{syntax} +\glossary(qbezier) +{\cs{qbezier}\oarg{num}\parg{Xs,Ys}\parg{Xm,Ym}\parg{Xe,Ye}}{Picture +command to draw a quadratic Bezier curve from \meta{Xs,Ys} to \meta{Xe,Ye} +passing near \meta{Xm,Ym}. If the optional argument is present exactly +\meta{num} segments will be used in drawing the curve.} + The command will draw what geometers call a \emph{quadratic Bezier +curve}\index{Bezier curve|seealso{picture object}} from the +point \parg{Xs, Ys} to the point \parg{Xe, Ye}. The +curve will pass somewhere near to the point \parg{Xm, Ym}. + + Bezier curves are named after Pierre Bezier\index{Bezier, Pierre} +who first used them in 1962. They are widely used in Computer Aided +Design (CAD) +programs and other graphics and font design systems. Descriptions, with +varying degrees of mathematical complexity, can be found in many places: +when I was a practicing geometer these included \cite{FAUX80}, +\cite{MORTENSON85} and \cite{FARIN90}; no doubt there are more recent +sources available and there is a brief review in~\cite{BEZ123}. + +Figure~\ref{lpicf:bez} shows two of these curves. The figure was +produced by the code below. + +%\begin{egsource}{eg11.15} +\begin{lcode} +\begin{figure} +\setlength{\unitlength}{1mm} +\centering +\begin{picture}(100,100) + +\thicklines % first curve +\qbezier(10,50)(50,90)(50,50) +\thinlines % draw lines joining control points +\put(10,50){\line(1,1){40}} +\put(50,90){\line(0,-1){40}} +% label control points +\put(10,45){\makebox(0,0)[t]{\texttt{(10,50)}}} +\put(50,95){\makebox(0,0)[b]{\texttt{(50,90)}}} +\put(55,50){\makebox(0,0)[l]{\texttt{(50,50)}}} + +\thicklines % second curve +\qbezier[25](50,50)(50,10)(90,50) +\thinlines % draw lines joining control points +% \put(50,50){\line(0,-1){40}} +% \put(50,10){\line(1,1){40}} +% label control points +\put(50,5){\makebox(0,0)[t]{\texttt{(50,10)}}} +\put(90,55){\makebox(0,0)[b]{\texttt{(90,50)}}} + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Two Bezier curves} +\label{lpicf:bez} +\end{figure} +\end{lcode} +%\end{egsource} + +\begin{figure} +\setlength{\unitlength}{1mm} +\centering +\begin{picture}(100,100) + +\thicklines % first curve +\qbezier(10,50)(50,90)(50,50) +\thinlines % draw lines joining control points +\put(10,50){\line(1,1){40}} +\put(50,90){\line(0,-1){40}} +% label control points +\put(10,45){\makebox(0,0)[t]{\texttt{(10,50)}}} +\put(50,95){\makebox(0,0)[b]{\texttt{(50,90)}}} +\put(55,50){\makebox(0,0)[l]{\texttt{(50,50)}}} + +\thicklines % second curve +\qbezier[25](50,50)(50,10)(90,50) +\thinlines % draw lines joining control points +% \put(50,50){\line(0,-1){40}} +% \put(50,10){\line(1,1){40}} +% label control points +\put(50,5){\makebox(0,0)[t]{\texttt{(50,10)}}} +\put(90,55){\makebox(0,0)[b]{\texttt{(90,50)}}} + +\end{picture} +\setlength{\unitlength}{1pt} +\caption{Two Bezier curves} +\label{lpicf:bez} +\end{figure} + + The three points used to specify the position and shape of the +Bezier curve are called +\emph{control points}\index{Bezier curve!control points}. +The curve starts at +the first control point and is tangent to the line joining the first +and second control points. The curve stops at the last control point +and is tangent to the line joining the last two control points. + + In \fref{lpicf:bez} the lines joining the control points for the +first curve have been drawn in. The locations of all the control points +for the two curves are labeled. + +The second Bezier curve is the same shape +as the first one, but rotated 180 degrees. The first control point +of this curve is the same as the last control point of the first curve. +This means that the two curves are joind at this point. The line, +although it is not drawn, +connecting the first two control points of the second curve is in the +same direction as the line joining the last two control points of the +first curve. This means that the two curves are also tangent at the +point where they join. By stringing together several Bezier curves +you can draw quite complex curved shapes. + +\begin{syntax} +\cmd{\qbeziermax} \\ +\end{syntax} +\glossary(qbeziermax) +{\cs{qbeziermax}}{The maximum number of segments for drawing a Bezier curve.} + The Bezier curves are actually drawn as a +linearized\index{Bezier curve!linearized rendition} form +using a series of rectangular +blobs of ink. Left to itself, \ltx\ will attempt to pick the number +of blobs to give the smoothest looking curve, up to a maximum number. +(Each blob takes up space in \ltx 's internal memory, and it may run +out of space if too many are used in one picture.) The maximum number +of blobs per Bezier curve is set by the \cmd{\qbeziermax} command. This +can be adjusted with the \cmd{\renewcommand} command. For example: +\begin{lcode} +\renewcommand{\qbeziermax}{250} +\end{lcode} +will set the maximum number of blobs to be 250. + + Another method of controlling the number of blobs is by +the optional \meta{num} argument to the \cmd{\qbezier} command. +If used, it must be a positive integer number which tells \ltx\ +exactly how many blobs to use for the curve. + + +%#% extend +%#% extstart include latex-and-tex.tex + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{\ltx\ and \tx} \label{appendix:alltex} @@ -31143,7 +33062,8 @@ but in this case the best place to look for further information is in the %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +%#% extend +%#% extstart include the-terrors-of-errors.tex @@ -33603,7 +35523,9 @@ recognized. %%\index{memoir class!warning|)} \Iclasssub{memoir}{warning|)} +%#% extend +%#% extstart input backend.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%\endinput @@ -33993,6 +35915,21 @@ access CTAN is available at \url{http://www.tug.org}. \newblock (Available from CTAN in \url{/help/uk-tex-faq}) +\LMnote{2010/02/08}{Added from the main bib file} +\bibitem[Far90]{FARIN90} +Gerald Farin. +\newblock {\em Curves and Surfaces for Computer Aided Geometric Design --- A + Practical Guide}. +\newblock Academic Press, 2 edition, 1990. + +\LMnote{2010/02/08}{Added from the main bib file} +\bibitem[FP80]{FAUX80} +I.~D. Faux and M.~J. Pratt. +\newblock {\em Computational Geometry for Design and Manufacture}. +\newblock Ellis Horwood, 1980. + + + %%% keep \bibitem[Fea03]{BOOKTABS} Simon Fear. @@ -34314,6 +36251,13 @@ access CTAN is available at \url{http://www.tug.org}. \newblock ISBN 1--56792--004--7. \end{comment} +\LMnote{2010/02/08}{Added from the main bib file} +\bibitem[Mor85]{MORTENSON85} +Michael~E. Mortenson. +\newblock {\em Geometric Modeling}. +\newblock John Wiley \& Sons, 1985. + + %%% keep \bibitem[NG98]{SIDECAP} Rolf Niespraschk and Hubert G\"{a}\ss{}lein. @@ -34478,6 +36422,19 @@ access CTAN is available at \url{http://www.tug.org}. \newblock ISBN 0--907259--06--5. \end{comment} + +\bibitem[Sch07]{practex-2007-3-ms} +Martin Scharrer, +\newblock\emph{Version Control of LaTeX Documents with svn-multi}. +\newblock \emph{The Prac{\TeX} Journal}, 3, 2007. +\newblock ISSN 1556-6994. + +\bibitem[Sch09]{svn-multi} +Martin Scharrer, +\newblock\emph{The \textsf{svn-multi} package}, 2009. +\newblock (Available from CTAN in \url{/macros/latex/contrib/svn-multi/}) + + %%% keep \bibitem[Sne04]{SNEEP04} Maarten Sneep. @@ -34747,6 +36704,14 @@ access CTAN is available at \url{http://www.tug.org}. \newblock TUGboat, 25, 2 pp 201--202, 2004. \end{comment} + +\LMnote{2010/02/08}{Added from the main bib file} +\bibitem[Wil04a]{BEZ123} +Peter Wilson. +\newblock {\em The bez123 and multiply packages}, April 2004. +\newblock (Available from CTAN in \url{/macros/latex/contrib/bez123}) + + %%% keep \bibitem[Wil04b]{PAGENOTE} Peter Wilson. @@ -34755,6 +36720,9 @@ access CTAN is available at \url{http://www.tug.org}. \newblock (Available from CTAN in \url{/macros/latex/contrib/pagenote}) + + + %%% keep \bibitem[Wil07a]{TITLEPAGES} Peter Wilson. @@ -34923,7 +36891,17 @@ Computer Modern family. \vfil +%#% extend + + \end{document} \endinput + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% TeX-source-specials-mode: t +%%% TeX-PDF-mode: nil +%%% End: |