Cahiers
enberg
GUT GUT GUT
m NEW INTERFACES FOR L A TEX CLASS DESIGN
P Frank Mittelbach , David Carlisle , Chris Rowley Cahiers GUTenberg, n 35-36 (2000), p. 115-120.
<http://cahiers.gutenberg.eu.org/fitem?id=CG_2000___35-36_115_0>
© Association GUTenberg, 2000, tous droits réservés.
L’accès aux articles des Cahiers GUTenberg (http://cahiers.gutenberg.eu.org/),
implique l’accord avec les conditions générales
d’utilisation (http://cahiers.gutenberg.eu.org/legal.html).
Toute utilisation commerciale ou impression systématique
est constitutive d’une infraction pénale. Toute copie ou impression
de ce fichier doit contenir la présente mention de copyright.
New Interfaces for L A
T
E
X Class Design
Frank Mittelbach[1], DavidCarlisle [2] and ChrisRowley [3]
[1]L A
T
E
X3Project
[2]L A
T
E
X3Project
[3]L A
T
E
X3ProjectandOpenUniversity, UK
1. Introduction
Traditional L A
T
E
X class les typically implement onexed designvia adhoc,
andoftenlow-level,(L A
)T
E
Xcode.Thisstyleofimplementationmakesitmuch
harderthaniseither desirableornecessaryto produceclassesthat implement
a specic visual design. Moreover, the construction of such classes typically
involvesalot of work that is essentially programmingand thus doesnot live
easilywiththedeclarativekindofdesignspecicationforadocument(orrange
ofdocuments)thatwouldbeproducedbyaprofessionaltypographicdesigner.
ThisworkintroducessomeextensionstoL A
T
E
Xthatwillhelptoprovideanew,
moredeclarativeinterfacethatcanbeusedinclassles.Itisbasedontheidea
ofatemplate,whichdescribeshowtocarryoutsomeactionbutwhichprovides
some exibility since its code uses the values of a set of named (keyword)
parameters. The specic design for this action, as required for a particular
class,isthenselectedbychoosingvaluesforthetemplate'snamedparameters.
2. Plans
We are currently working on the creation of standard templates for a wide
rangeoftypographicobjectsbut,ofcourse,newtemplatesfornewideascanbe
created,possiblybyadaptinganexistingoneorbyalittleL A
T
E
Xprogramming.
1
1. Thatthisisnotjustwishfulthinkingwasprovenbymembersofthelatex-llist,who
providedexperimentaltemplatesand convertedexistingL A
T
E
X-code,suchasA
M S-L
A
T
E X's
theoremimplementation(seepage119),intotemplates,therebymakingitsadaptiontonew
Itisourrmbeliefthattherewillsoonbealargerangeoftemplatesavailable
andthatitwillthusbepossibleforthemajorityofclasslestobeimplemented
inadeclarativeway,bysimplychoosingsuitabletemplatesandsupplyingvalues
fortheirnamedparameters.
3. Spin-o technology
WhilstapplyingtheideaoftemplatestodocumentdesigninL A
T
E
Xwehavehad
theopportunitytosubstantiallyrethinkmanyofthebasicconceptsofL A
T
E X's
formattingmachinery.Thishasledtothedevelopmentofmajorenhancements
in thefollowingpartsofL A
T
E X .
Paragraphs: Therewill beacompletely newmodel anddesign interfacefor
allaspects ofparagraph-making,including: theparametersthat control
T
E
X's hyphenationandjusticationsystem;specialtypographicaltreat-
mentof thebeginning andend of paragraphs,e.g., initialletters/words
(lettrines),nestedrun-onheadings,etc.
Galleys: The paragraph model will be linked to a new model for the con-
structionof galleysfromparagraphsandother material;this modelwill
incorporatecurrentstandardL A
T
E
Xconceptssuchaslogicallabels,marks
andcolour-changenodes, togetherwith moreexperimentalobjectssuch
ashyper-informationnodes.
Independentcolumn-marks: Support for independent mark classes. For
each class the rst and the last mark on each column/page can be re-
trievedanddisplayedseparately.Thisgivesmoreexibilityin providing
runningheadersand footers.
Floats: Theseelementshaveundergone amajorredevelopment:
Captions: Theformattingandpositioningofthecaptioncanbedecided
individuallyforeachoatandcandependonexactlywhereonthe
spreaditappears.
Position: Thepositionspecicationallowschangesiftheoatdoesnot
tonthecurrentpage.
Pages: Moreexibilityand better specicationofbothindividual oat
pagesandsequencesofoatpages(e.g.,atchapterends),including
morepossibilitiestochoosewhetheratextpageoroatpageshould
beused.
Margins: Betterintegrationofoatsandmarginalmaterial,allowingoatsto
appearinmarginsandfortexttobechangedaccordingtowhichmargin
NewInterfacesfor LT
E
XClass Design 117
Page layout: Moretypesofpagesandspreadswithin adocument;morelay-
out choices and parameterisations.This and the previoustwoitems re-
quireacompletelynewoutputroutineconceptforL A
T
E X.
Alignment: Bettersupportforalignmentbetween`minipages',speciedusing
logicalhandlessuchas`topcentre',`centreleft'or`rstbaselineright':the
relativepositioningoftwoboxes(withsuchhandles)isdonebychoosing
ahandleoneachboxandthe(2-D)osetbetweenthese handles.
Documentcommands: Newtoolsforprovidingdocument-levelsyntax.
Separation of inputsyntax and formatting: Thedocument-levelsyntax
will be completely separated from thespecication of layout. This will
allow the use of dierent front-end languages such as XML to specify
documentsource.
Professional support: For editorial and page make-up processes currently
used in the publishing industry: e.g.,exible manualcontrol overposi-
tioningofoats,etc.in thenal formdocument;automatedhandlingof
complexbibliographicinformationinthefront-matterofjournalarticles.
These areall, ofcourse, still severelylimitedby what ispracticalwithin cur-
rentT
E
X;forexample,precisecontroloverpage-breakingwithinparagraphsis
simplyunobtainableusingT
E
X'sstandardmechanisms.Nevertheless,wehope
thatwhatwehavebeenabletodowillinspireotherstousethetoolsweprovide
inthecreationanduseofhigh-qualitytypographicdesigns.
4. Presentation
This presentation isonein a seriesof talks weare givingon this work;these
areintendedtoincreaseawarenessofthis work,to providelastminutedetails
ofits implementation, and toinvite listeners to join in discussionof boththe
underlyingconceptsandaspectsoftheirimplementation.
Thetalksexplaintheseconceptsandshowexamplesoftheiruse,coveringboth
thecurrentstandardL A
T
E
Xdesigns andsomemoreexcitingnew possibilities.
Theyincludeworkingexamplesoftheapplicationoftheseideasin mostofthe
majorareasofdocumentdesign,includingpagelayout,sectionheadings,lists
and captions. Weshall also report on thecurrentstatus of this work and on
5. The Current Status
The slides from the TUG'99 talk we gave on anew interface for L A
T
E X class
designers are available from the L A
T
E
X Project web-site; look for the le
tug99.pdfat:http://www.latex-project.org/talks/
Pleasenotethatthenotesaccompanyingthoseslideswereonlyintendedtobe
informalspeaker'snotesforourownuse.Wedecidedtomakethemavailable
(the speaker'snotes aswellastheslidesthat were presented) becauseseveral
people requested copies after the talk. However, they are not in a polished
copy-editedformandarenotintendedforpublication.
Prototype implementations of parts of this interface are now available from:
http://www.latex-project.org/code/experimental/
Wearecontinuingto addnewmaterialatthislocationsoasto stimulate fur-
therdiscussionoftheunderlyingconcepts.Asof18thApril2000thefollowing
parts can be downloaded.
2
All examples are organised in subdirectories and
additionallyavailableas gziptarles.
xparse This module contains theprototype implementation of the interface
for declaring document command syntax. It supports the denition of
usercommands witha L A
T
E X2
"
interfaceincluding starforms, optional
arguments,andpicturemodearguments.Seethe.dtxlesfordocumen-
tation. It is possible to use this interface independently from all other
modulesdescribedbelow.
template Thismodulecontainstheprototypeimplementationofthetemplate
interface.Togetherwithxparseitformsthebasisofallfurthermodules,
i.e.,tomakeuseofanyoftheothermodules youneedboth.
Thele template.dtxinthatdirectoryhasalargesectionofdocumen-
tationat thefrontdescribing thecommandsin the interfaceandgiving
a`workedexample'tobuildupsometemplatesforcaptionformatting.
galley2 This module documents a new data structure for galley-related in-
formation, i.e., a data structure to better support handling of inter-
paragraphmaterial. Besideimplementinglower-levelprogrammermuta-
torfunctionsforthisdatastructureitprovideshigher-leveltemplatesfor
declaringparagraphshapesandH&J(hyphenation&justication)specs.
Mostother modules willeventuallydepend onitsservicesasparagraph
handlingisneededformostaspectsoflayout.
2. Pleaserememberthatthismaterialisintendedonlyforexperimentationandcomments;
thusanyaspectof it,e.g.,theuserinterfaceorthe functionality,maychangeand,infact,
isvery likelyto change.For thisreason it isexplicitlyforbidden toplacethismaterialon
NewInterfacesfor LT
E
XClass Design 119
xcontents This module contains the interface description for table of con-
tentsdata,describing bothanextended datamodel to replacethedata
deposited byheading commands into a.tocle and anumberof tem-
platetypedescriptionsformanipulatingsuchdata.Thereiscurrentlyno
codeprovidedtoproducespeciallyformattedtableofcontents;however,
usableexamplesforthetemplateshavebeenthoroughlydiscussedonthe
latex-llist,whichcanberetrievedasexplainedbelow.
xfootnote Thismodulecontainsdocumentedworkingexamplesforgenerating
footnotes, etc. It implements some of the functionality of the package
footmiscby RobinFairbainsandprovides,although still incomplete,a
goodintroductionto theusefulnessof templatesin class design.Due to
thefactthatsupportmodulesforparagraphmanipulation,etc.werestill
under development when the module waswritten, most of the current
implementationshouldbeconsideredasarstdraftonly.Whenthenew
output routine module (xor) is nished the xfootnote module will be
replacedbyaversionintegratedwiththenewoutputroutineconcepts.
xinitials This module implements atemplate for paragraphinitials. An ex-
ampleofitsusecanbeadmiredintheslidesofourtalk.
xtheorem ThismodulereimplementsA
M S-L
A
T
E
X'stheoremenvironmentem-
ployingthenewtemplate mechanism.ItwaswrittenbyAchimBlumen-
sathasanexerciseand nicelyshowsthat thetemplatemechanismhelps
tomakecomplicatedcodebotheasierto understandandsimplertocus-
tomise.
Modules currently under development include the following. Some if not all
mightbepubliclyavailablebythetimeyoureadthisthis document.
xlists This module documents and implements templates that provide vari-
ouskindsof list structures.It will includeasexamplesafull set oflists
compatible in designwith theL A
T
E X2
"
article class;these will be im-
plementedasinstancesofthetemplatesprovided.Theprototypecodefor
thismoduleisnishedbutrequires furtherdocumentation.
xmarks Thismoduleimplementsindependentmarkclassestherebyextending
T
E
X's\topmark,\firstmark,and\botmarkconcept.Oneofitsimpor-
tant applicationsis internalto thenewoutputroutineconcept whereit
isused to storeinformation aboutthecalloutpositionsforoats within
eachcolumn.
xor This module will contain thenew outputroutinefor L A
T
E
X allowingthe
implemention of more general oat positioning algorithms and oering
extended page-layoutcontrol.This module iscurrentlyunder activede-
velopmentanditsrstpublicproto-typereleaseisscheduledforthesec-
These concepts, aswell astheir implementation, are under discussion on the
listLATEX-L.Youcanjointhislist,whichisintendedsolelyfordiscussingideas
and conceptsforfuture versionsofL A
T
E
X, bysendingmailto
containingtheline
SUBSCRIBE LATEX-LYourName
This listis archivedand,after subscription, you canretrieveolderposts to it
bysendingmailto theaboveaddress,containingacommandsuchas:
GET LATEX-L LOGyymm
where yy=Year and mm=Month, e.g.,GET LATEX-L LOG9910for all messages
sentinOctober1999.