• Tidak ada hasil yang ditemukan

17.1 Messages 45

63 \ledmac@warning{Bad \string\lockdisp\space argument}}

64\newcommand*{\led@warn@BadSublockdisp}{%

65 \ledmac@warning{Bad \string\sublockdisp\space argument}}

\led@warn@NoLineFile

66\newcommand*{\led@warn@NoLineFile}[1]{%

67 \ledmac@warning{Can’t find line-list file #1}}

\led@warn@BadAdvancelineSubline

\led@warn@BadAdvancelineLine 68\newcommand*{\led@warn@BadAdvancelineSubline}{%

69 \ledmac@warning{\string\advanceline\space produced a sub-line

70 number less than zero.}}

71\newcommand*{\led@warn@BadAdvancelineLine}{%

72 \ledmac@warning{\string\advanceline\space produced a line

73 number less than zero.}}

\led@warn@BadSetline

\led@warn@BadSetlinenum 74\newcommand*{\led@warn@BadSetline}{%

75 \ledmac@warning{Bad \string\setline\space argument}}

76\newcommand*{\led@warn@BadSetlinenum}{%

77 \ledmac@warning{Bad \string\setlinenum\space argument}}

\led@err@PstartNotNumbered

\led@err@PstartInPstart

\led@err@PendNotNumbered

\led@err@PendNoPstart

\led@err@AutoparNotNumbered

78\newcommand*{\led@err@PstartNotNumbered}{%

79 \ledmac@error{\string\pstart\space must be used within a

80 numbered section}{\@ehc}}

81\newcommand*{\led@err@PstartInPstart}{%

82 \ledmac@error{\string\pstart\space encountered while another

83 \string\pstart\space was in effect}{\@ehc}}

84\newcommand*{\led@err@PendNotNumbered}{%

85 \ledmac@error{\string\pend\space must be used within a

86 numbered section}{\@ehc}}

87\newcommand*{\led@err@PendNoPstart}{%

88 \ledmac@error{\string\pend\space must follow a \string\pstart}{\@ehc}}

89\newcommand*{\led@err@AutoparNotNumbered}{%

90 \ledmac@error{\string\autopar\space must be used within a

91 numbered section}{\@ehc}}

\led@warn@BadAction

92\newcommand*{\led@warn@BadAction}{%

93 \ledmac@warning{Bad action code, value \next@action.}}

\led@warn@DuplicateLabel

\led@warn@RefUndefined 94\newcommand*{\led@warn@DuplicateLabel}[1]{%

95 \ledmac@warning{Duplicate definition of label ‘#1’ on page \the\pageno.}}

96\newcommand*{\led@warn@RefUndefined}[1]{%

97 \ledmac@warning{Reference ‘#1’ on page \the\pageno\space undefined.

98 Using ‘000’.}}

\led@warn@NoMarginpars

99\newcommand*{\led@warn@NoMarginpars}{%

100 \ledmac@warning{You can’t use \string\marginpar\space in numbered text}}

\led@warn@BadSidenotemargin

101\newcommand*{\led@warn@BadSidenotemargin}{%

102 \ledmac@warning{Bad \string\sidenotemmargin\space argument}}

\led@warn@NoIndexFile

103\newcommand*{\led@warn@NoIndexFile}[1]{%

104 \ledmac@warning{Undefined index file #1}}

\led@err@TooManyColumns

\led@err@UnequalColumns

\led@err@LowStartColumn

\led@err@HighEndColumn

\led@err@ReverseColumns

105\newcommand*{\led@err@TooManyColumns}{%

106 \ledmac@error{Too many columns}{\@ehc}}

107\newcommand*{\led@err@UnequalColumns}{%

108 \ledmac@error{Number of columns is not equal to the number

109 in the previous row (or \protect\\ \space forgotten?)}{\@ehc}}

110\newcommand*{\led@err@LowStartColumn}{%

111 \ledmac@error{Start column is too low}{\@ehc}}

112\newcommand*{\led@err@HighEndColumn}{%

113 \ledmac@error{End column is too high}{\@ehc}}

114\newcommand*{\led@err@ReverseColumns}{%

115 \ledmac@error{Start column is greater than end column}{\@ehc}}

18 Sectioning commands

\section@num You use\beginnumberingand\endnumberingto begin and end a line-numbered section of the text; the pair of commands may be used as many times as you like within one document to start and end multiple, separately line-numbered sections. LaTeX will maintain and display a ‘section number’ as a count named

\section@numthat counts how many \beginnumberingand \resumenumbering commands have appeared; it needn’t be related to the logical divisions of your text.

\extensionchars Each section will read and write an associated ‘line-list file’, containing information used to do the numbering; the file will be calledhjobnamei.nn, where nn is the section number. However, you may direct that an extra string be added before the nnin that filename, in order to distinguish these temporary files from others: that string is called \extensionchars. Initially it’s empty, since different operating systems have greatly varying ideas about what characters are permitted in file names. So \renewcommand{\extensionchars}{-} gives temporary files called jobname.-1,jobname.-2, etc.

116\newcount\section@num

117\section@num=0

118\let\extensionchars=\empty

47

\ifnumbering

\numberingtrue

\numberingfalse

The\ifnumberingflag is set totrue if we’re within a numbered section (that is, between \beginnumberingand \endnumbering). You can use\ifnumbering in your own code to check whether you’re in a numbered section, but don’t change the flag’s value.

119\newif\ifnumbering

\ifnumberingR

\ifl@dpairing

\l@dpairingtrue

\l@dpairingfalse

\ifpst@rtedL

\pst@rtedLtrue

\pst@rtedLfalse

\l@dnumpstartsL

\ifledRcol

In preparation for theledparpackage, these are related to the ‘left’ text of parallel texts (when\ifl@dpairingis TRUE). They are explained in theledparmanual.

120\newif\ifl@dpairing

121 \l@dpairingfalse

122\newif\ifpst@rtedL

123 \pst@rtedLfalse

124\newcount\l@dnumpstartsL

125\newif\ifledRcol

The \ifnumberingR flag is set to true if we’re within a right text numbered section.

126\newif\ifnumberingR

\beginnumbering

\initnumbering@reg

\beginnumbering begins a section of numbered text. When it’s executed we increment the section number, initialize our counters, send a message to your terminal, and call macros to start the lineation machinery and endnote files.

The initializations here are trickier than they look.\line@list@stuffwill use all of the counters that are zeroed here when it assembles the line-list and other lists of information about the lineation. But it will do all of this locally and within a group, and when it’s done the lists will remain but the counters will return to zero. Those same counters will then be used as we process the text of this section, but the assignments will be made globally. These initializations actually apply to both uses, though in all other respects there should be no direct interaction between the use of these counters and variables in the two processing steps.

127\newcommand*{\beginnumbering}{%

128 \ifnumbering

129 \led@err@NumberingStarted

130 \endnumbering

131 \fi

132 \global\numberingtrue

133 \global\advance\section@num \@ne

134 \initnumbering@reg

135 \message{Section \the\section@num }%

136 \line@list@stuff{\jobname.\extensionchars\the\section@num}%

137 \l@dend@stuff

138 \setcounter{pstart}{1}

139}

140\newcommand*{\initnumbering@reg}{%

141 \global\pst@rtedLfalse

142 \global\l@dnumpstartsL \z@

143 \global\absline@num \z@

144 \global\line@num \z@

145 \global\subline@num \z@

146 \global\@lock \z@

147 \global\sub@lock \z@

148 \global\sublines@false

149 \global\let\next@page@num=\relax

150 \global\let\sub@change=\relax}

151

\endnumbering \endnumberingmust follow the last text for a numbered section. It takes care of notifying you when changes have been noted in the input that require running the file through again to move everything to the right place.

152\def\endnumbering{%

153 \ifnumbering

154 \global\numberingfalse

155 \normal@pars

156 \ifl@dpairing

157 \global\pst@rtedLfalse

158 \else

159 \ifx\insertlines@list\empty\else

160 \global\noteschanged@true

161 \fi

162 \ifx\line@list\empty\else

163 \global\noteschanged@true

164 \fi

165 \fi

166 \ifnoteschanged@

167 \led@mess@NotesChanged

168 \fi

169 \else

170 \led@err@NumberingNotStarted

171 \fi

172 \autoparfalse}

\pausenumbering

\resumenumbering

The \pausenumbering macro is just the same as\endnumbering, but with the

\ifnumberingflag set totrue, to show that numbering continues across the gap.22

173\newcommand{\pausenumbering}{%

174 \endnumbering\global\numberingtrue}

The \resumenumbering macro is a bit more involved, but not much. It does most of the same things as \beginnumbering, but without resetting the vari- ous counters. Note that no check is made by\resumenumbering to ensure that

\pausenumberingwas actually invoked.

175\newcommand*{\resumenumbering}{%

176 \ifnumbering

177 \global\pst@rtedLtrue

178 \global\advance\section@num \@ne

179 \led@mess@SectionContinued{\the\section@num}%

180 \line@list@stuff{\jobname.\extensionchars\the\section@num}%

22Our thanks to Wayne Sullivan, who suggested the idea behind these macros.

49

181 \l@dend@stuff

182 \else

183 \led@err@NumberingShouldHaveStarted

184 \endnumbering

185 \beginnumbering

186 \fi}

187

19 Line counting

19.1 Choosing the system of lineation

Sometimes you want line numbers that start at 1 at the top of each page; sometimes you want line numbers that start at 1 at each\pstart; other times you want line numbers that start at 1 at the start of each section and increase regardless of page breaks. ledmac can do it either way, and you can switch from one to the other within one work. But you have to choose one or the other for all line numbers and line references within each section. Here we will define internal codes for these systems and the macros you use to select them.

\ifbypstart@

\bypstart@true

\bypstart@false

\ifbypage@

\bypage@true

\bypage@false

The\ifbypage@and\ifbypstart@ flag specifie the current lineation system:

• line-of-page : bypstart@ = false andbypage@ = true.

• line-of-pstart : bypstart@ = trueandbypage@ = false.

ledmacwill use the line-of-section system unless instructed otherwise.

188\newif\ifbypage@

189\newif\ifbypstart@

\lineation \lineation{hwordi} is the macro you use to select the lineation system. Its argument is a string: eitherpage orsectionorpstart.

190\newcommand*{\lineation}[1]{{%

191 \ifnumbering

192 \led@err@LineationInNumbered

193 \else

194 \def\@tempa{#1}\def\@tempb{page}%

195 \ifx\@tempa\@tempb

196 \global\bypage@true

197 \global\bypstart@false

198 \else

199 \def\@tempb{pstart}%

200 \ifx\@tempa\@tempb

201 \global\bypage@false

202 \global\bypstart@true

203 \else

204 \def\@tempb{section}

205 \ifx\@tempa\@tempb

206 \global\bypage@false

207 \global\bypstart@false

208 \else

209 \led@warn@BadLineation

210 \fi

211 \fi

212 \fi

213 \fi}}

\linenummargin

\line@margin

\l@dgetline@margin

You call \linenummargin{hwordi} to specify which margin you want your line numbers in; it takes one argument, a string. You can put the line numbers in the same margin on every page using left or right; or you can use inner or outerto get them in the inner or outer margins. (These last two options assume that even-numbered pages will be on the left-hand side of every opening in your book.) You can change this within a numbered section, but the change may not take effect just when you’d like; if it’s done between paragraphs nothing surprising should happen.

The selection is recorded in the count\line@margin: 0 for left, 1 for right, 2 for outer, and 3 for inner.

214\newcount\line@margin

215\newcommand*{\linenummargin}[1]{{%

216 \l@dgetline@margin{#1}%

217 \ifnum\@l@dtempcntb>\m@ne

218 \global\line@margin=\@l@dtempcntb

219 \fi}}

220\newcommand*{\l@dgetline@margin}[1]{%

221 \def\@tempa{#1}\def\@tempb{left}%

222 \ifx\@tempa\@tempb

223 \@l@dtempcntb \z@

224 \else

225 \def\@tempb{right}%

226 \ifx\@tempa\@tempb

227 \@l@dtempcntb \@ne

228 \else

229 \def\@tempb{outer}%

230 \ifx\@tempa\@tempb

231 \@l@dtempcntb \tw@

232 \else

233 \def\@tempb{inner}%

234 \ifx\@tempa\@tempb

235 \@l@dtempcntb \thr@@

236 \else

237 \led@warn@BadLinenummargin

238 \@l@dtempcntb \m@ne

239 \fi

240 \fi

241 \fi

242 \fi}

243

19.1 Choosing the system of lineation 51

\c@firstlinenum

\c@linenumincrement

The following counters tellledmacwhich lines should be printed with line numbers.

firstlinenum is the number of the first line in each section that gets a number;

linenumincrementis the difference between successive numbered lines. The initial values of these counters produce labels on lines 5, 10, 15, etc. linenumincrement must be at least 1.

244\newcounter{firstlinenum}

245 \setcounter{firstlinenum}{5}

246\newcounter{linenumincrement}

247 \setcounter{linenumincrement}{5}

\c@firstsublinenum

\c@sublinenumincrement

The following parameters are just likefirstlinenumandlinenumincrement, but for sub-line numbers. sublinenumincrementmust be at least 1.

248\newcounter{firstsublinenum}

249 \setcounter{firstsublinenum}{5}

250\newcounter{sublinenumincrement}

251 \setcounter{sublinenumincrement}{5}

252

\firstlinenum

\linenumincrement

\firstsublinenum

\sublinenumincrement

These macros can be used to set the corresponding counters.

253\newcommand*{\firstlinenum}[1]{\setcounter{firstlinenum}{#1}}

254\newcommand*{\linenumincrement}[1]{\setcounter{linenumincrement}{#1}}

255\newcommand*{\firstsublinenum}[1]{\setcounter{firstsublinenum}{#1}}

256\newcommand*{\sublinenumincrement}[1]{\setcounter{sublinenumincrement}{#1}}

257

\lockdisp

\lock@disp

\l@dgetlock@disp

When line locking is being used, the\lockdisp{hwordi}macro specifies whether a line number—if one is due to appear—should be printed on the first printed line or on the last, or by all of them. Its argument is a word, eitherfirst, last, or all. Initially, it is set tofirst.

\lock@dispencodes the selection: 0 for first, 1 for last, 2 for all.

258\newcount\lock@disp

259\newcommand{\lockdisp}[1]{{%

260 \l@dgetlock@disp{#1}%

261 \ifnum\@l@dtempcntb>\m@ne

262 \global\lock@disp=\@l@dtempcntb

263 \else

264 \led@warn@BadLockdisp

265 \fi}}

266\newcommand*{\l@dgetlock@disp}[1]{

267 \def\@tempa{#1}\def\@tempb{first}%

268 \ifx\@tempa\@tempb

269 \@l@dtempcntb \z@

270 \else

271 \def\@tempb{last}%

272 \ifx\@tempa\@tempb

273 \@l@dtempcntb \@ne

274 \else

275 \def\@tempb{all}%

276 \ifx\@tempa\@tempb

277 \@l@dtempcntb \tw@

278 \else

279 \@l@dtempcntb \m@ne

280 \fi

281 \fi

282 \fi}

283

\sublockdisp

\sublock@disp

The same questions about where to print the line number apply to sub-lines, and these are the analogous macros for dealing with the problem.

284\newcount\sublock@disp

285\newcommand{\sublockdisp}[1]{{%

286 \l@dgetlock@disp{#1}%

287 \ifnum\@l@dtempcntb>\m@ne

288 \global\sublock@disp=\@l@dtempcntb

289 \else

290 \led@warn@BadSublockdisp

291 \fi}}

292

\linenumberstyle

\linenumrep

\linenumr@p

\sublinenumberstyle

\sublinenumrep

\sublinenumr@p

We provide a mechanism for using different representations of the line numbers, not just the normal arabic.

NOTE: In v0.7\linenumrepand\sublinenumrepreplaced the internal\linenumr@p and\sublinenumr@p.

\linenumberstyleand\sublinenumberstyleare user level macros for setting the number represention (\linenumrep and\sublinenumrep) for line and sub-line numbers.

293\newcommand*{\linenumberstyle}[1]{%

294 \def\linenumrep##1{\@nameuse{@#1}{##1}}}

295\newcommand*{\sublinenumberstyle}[1]{%

296 \def\sublinenumrep##1{\@nameuse{@#1}{##1}}}

Initialise the number styles to arabic.

297\linenumberstyle{arabic}

298 \let\linenumr@p\linenumrep

299\sublinenumberstyle{arabic}

300 \let\sublinenumr@p\sublinenumrep

301

\leftlinenum

\rightlinenum

\linenumsep

\numlabfont

\ledlinenum

\leftlinenum and \rightlinenum are the macros that are called to print marginal line numbers on a page, for left- and right-hand margins respectively.

They’re made easy to access and change, since you may often want to change the styling in some way. These standard versions illustrate the general sort of thing that will be needed; they’re based on the\leftheadlinemacro inThe TeXbook, p. 416.

Whatever these macros output gets printed in a box that will be put into the appropriate margin without any space between it and the line of text. You’ll generally want a kern between a line number and the text, and \linenumsep is

Dalam dokumen EDMAC, TABMAC and EDSTANZA to LaTeX ∗ (Halaman 44-53)