.net c# pdf viewer : Combine pdf application Library utility html .net asp.net visual studio letterfaq25-part540

doeswhatisrequired,and
\ghi{gloom}
willexpandto“gloom,ohgloom!”,whatever
theargumentto
\abc
.
Thedoublingisneededwhetherornottheenclosingcommandhasanargument,so:
\newcommand{\abc}{joy, oh joy!%
\newcommand{\ghi}[1]{gloom, oh ##1!}%
}
isneededtoproduceareplicaofthe
\ghi
wedefinedearlier.
357 Howtoprintcontentsofvariables?
Itisoftenusefultoprintoutthevaluesofvariablesinthelogfileorontheterminal.
Threepossiblewaystoprintoutthecontentsof
\textheight
variableare:
1.
\showthe\textheight
2.
\message{The text height t is \the\textheight}
3.
\typeout{The text height t is \the\textheight}
ThesetechniquesusetheTeXprimitives
\the
(whichprovidesthevalueofavariable),
\showthe
(printavariable totheterminalandthelog,onalineofitsown),and
\message
,whichinterpolatessomethingintothelog. Thecommand
\typeout
is
LaTeX’sgeneralmessageoutputmechanism.
Ineachcase,thevariable’svalueisprintedasanumberofpoints.
Totypesetthevalueof
\textheight
,just
\the\textheight
isenough,butamore
flexiblealternativeistousetheprintlenpackage.Printlenallowsyoutochoosethe
unitsinwhichyouprintavariable;thisisuseful,giventhatthemostordinarypeople
don’tthinkinpoints(particularlyKnuth’spoints,ofwhichthereare72.27totheinch).
So,usingprintlen,wecouldsay:
\newlength{\foo}
\setlength{\foo}{12pt}
\verb|\foo| is s \printlength{\foo}
andget:
\foo
is12pt
while,ifwesay:
\newlength{\foo}
\setlength{\foo}{12pt}
\uselengthunit{mm}
\verb|foo| is \printlength{\foo}
weget:
\foo
is4.21747mm
printlen.sty
:
macros/latex/contrib/printlen
358 Usinglabelsascountervalues
Labelsaretemptingsourcesof‘numbers’—theirmostcommonuse,afterall,issimply
totypesetanumber.However,theirseemingsimplicityisdeceptive;thepackagesbabel
andhyperref,atleast,fiddlewiththedefinitionof
\ref
and
\pageref
inwaysthat
make
\setcounter{foo}{\ref{bar}}
(etc.)notwork;thusthetechniquemaynotbereliedupon.
Thesolutionistousetherefcountpackage(incidentally,bytheauthorofhyperref).
Thepackageprovidesfourcommands,allsimilarto:
251
Combine pdf - Merge, append PDF files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provide C# Demo Codes for Merging and Appending PDF Document
merge pdf files; merge pdf
Combine pdf - VB.NET PDF File Merge Library: Merge, append PDF files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET Guide and Sample Codes to Merge PDF Documents in .NET Project
reader create pdf multiple files; asp.net merge pdf files
\usepackage{refcount}
...
\label{bar}
...
\setcounterref{foo}{bar}
(theotherthreeare
\addtocounterref
,
\setcounterpageref
and
\addtocounterpageref
).
Thepackagealsoprovidesacommand
\getrefnumber{label-name}
thatmaybe
usedwherea‘number’valueisneeded.Forexample:
... \footnote{foo bar ...\label{foofoot}}
...
\footnotemark[\getrefnumber{foofoot}]
whichgivesyouasecondfootnotemarkreferencethethefootnote.(Thereisalsoa
command
\getpagerefnumber
,ofcourse).
Thecommandscouldbeusedbyonedeterminednottousechangepagetodetermine
whetherthecurrentpageisodd,butit’sprobablynomoretroubletousethefully-
developedtoolinthiscase.
refount.sty
: Distributedaspartof
macros/latex/contrib/oberdiek
R.3 LaTeXmacroprogramming
359 HowtochangeLaTeX’s“fixednames”
LaTeXdocumentclassesdefine severaltypographicoperationsthatneed‘canned
text’(textnotsuppliedbytheuser). IntheearliestdaysofLaTeX2.09thesebits
oftextwerebuiltintothebodyofLaTeX’smacrosandwereratherdifficulttochange,
but“fixedname”macroswereintroducedforthebenefitofthosewishingtouseLa-
TeXinlanguagesotherthanEnglish.Forexample,thespecialsectionproducedby
the
\tableofcontents
commandisalwayscalled
\contentsname
(orrather,what
\contentsname
isdefinedtomean).Changingthecannedtextisnowoneoftheeasiest
customisationsausercandotoLaTeX.
Thecannedtextmacrosarealloftheform
\
h
thing
i
name
,andchangingthemis
simplicityitself.Put:
\renewcommand{\
h
thing
i
name}{Res minor}
inthepreambleofyourdocument,andthejobisdone.(However,bewareofthebabel
package,whichrequiresyoutouseadifferentmechanism:besuretocheckchanging
babelnamesifyou’reusingit.)
ThenamesthataredefinedinthestandardLaTeXclasses(andthemakeidxpackage)
arelistedbelow.Someofthenamesareonlydefinedinasubsetoftheclasses(andthe
letterclasshasasetofnamesallofitsown);thelistshowsthespecialisationofeach
name,whereappropriate.
252
Online Merge PDF files. Best free online merge PDF tool.
RasterEdge C#.NET PDF document merging toolkit (XDoc.PDF) is designed to help .NET developers combine PDF document files created by different users to one PDF
acrobat combine pdf files; pdf merger
C# PDF: C#.NET PDF Document Merging & Splitting Control SDK
PDF Merging & Splitting Application. This C#.NET PDF document merger & splitter control toolkit is designed to help .NET developers combine PDF document files
combine pdfs online; adding pdf pages together
\abstractname
Abstract
\alsoname
seealso(makeidxpackage)
\appendixname
Appendix
\bibname
Bibliography(report,book)
\ccname
cc(letter)
\chaptername
Chapter(report,book)
\contentsname
Contents
\enclname
encl(letter)
\figurename
Figure(forcaptions)
\headtoname
To(letter)
\indexname
Index
\listfigurename
ListofFigures
\listtablename
ListofTables
\pagename
Page(letter)
\partname
Part
\refname
References(article)
\seename
see(makeidxpackage)
\tablename
Table(forcaption)
360 Changingthewordsbabeluses
LaTeXusessymbolicnamesformanyoftheautomatically-generatedtextitproduces
(special-purposesectionheadings,captions,etc.).Asnotedin“LaTeXfixednames”
(whichincludesalistofthenamesthemselves),thisenablestheusertochangethe
namesusedbythestandardclasses,whichisparticularlyusefulifthedocumentisbeing
preparedinsomelanguageotherthanLaTeX’sdefaultEnglish. So,forexample,a
Danishauthormaywishthathertableofcontentswascalled“Indholdsfortegnelse”,
andsowouldexpecttoplaceacommand
\renewcommand{\contentsname}%
{Indholdsfortegnelse}
inthepreambleofherdocument.
However,it’snaturalforauserofanon-Englishlanguagetousebabel,because
itoffersmanyconveniencesandtypesettingnicetiesforthosepreparingdocuments
inthoselanguages.Inparticular,whenbabelisselectinganewlanguage,itensures
thatLaTeX’ssymbolicnamesaretranslatedappropriatelyforthelanguageinquestion.
Unfortunately,babel’schoiceofnamesisn’talwaystoeveryone’schoice,andthereis
stillaneedforamechanismtoreplacethe‘standard’names.
Wheneveranewlanguageisselected,babelresetsallthenamestothesettingsfor
thatlanguage.Inparticular,babelselectsthedocument’smainlanguagewhen
\begin
{document}
isexecuted,whichimmediatelydestroysanychangestothesesymbolic
namesmadeintheprologueofadocumentthatusesbabel.
Therefore,babeldefinesacommandtoenableuserstochangethedefinitionsof
thesymbolicnames,onaper-languagebasis:
\addto\captions
h
language
iisthe
thing(h
language
ibeingthelanguageoptionyougavetobabelinthefirstplace).For
example:
\addto\captionsdanish{%
\renewcommand{\contentsname}%
{Indholdsfortegnelse}%
}
361 Runningequation,figureandtablenumbering
ManyLaTeXclasses(includingthestandardbookclass)numberthingsperchapter;so
figuresinchapter1arenumbered1.1,1.2,andsoon.Sometimesthisisnotappropriate
fortheuser’sneeds.
Shortofrewritingthewhole class,onemayusethechngcntrpackage,which
providescommands
\counterwithin
(whichestablishesthisnestednumberingrela-
tionship)and
\counterwithout
(whichundoesit).
Soifyouhavefiguresnumberedbychapteras1.1,1.2,2.1,...,thecommand
253
VB.NET PDF: Use VB.NET Code to Merge and Split PDF Documents
Combine End Sub Private Sub Combine(source As List(Of [String]), destn As [String]) Implements PDFDocument.Combine End Sub. APIs for Splitting PDF document in
c# merge pdf pages; best pdf combiner
C# PowerPoint - Merge PowerPoint Documents in C#.NET
Combine and Merge Multiple PowerPoint Files into One Using C#. This part illustrates how to combine three PowerPoint files into a new file in C# application.
c# pdf merge; add pdf files together online
\counterwithout{figure}{chapter}
willconvertthemtofigures1,2,3,....(Notethatthecommandhasalsoremovedthe
chapternumberfromthecounter’sdefinition.)
Moreelaborateusecouldchangethingsnumberedpersectiontothingsnumbered
perchapter:
\counterwithout{equation}{section}
\counterwithin{equation}{chapter}
(assumingtherewasaclassthatdidsuchathinginthefirstplace...)
Thechngcntrapproachdoesn’tinvolvemuchprogramming,andtheenthusiasticLa-
TeXprogrammermightchoosetotrythetechniquethatwehadtousebeforetheadvent
ofchngcntr.Eachofthepackagesremovefrandremresetdefinesa
\@removefromreset
command,andhavingincludedthepackageonewritessomethinglike:
\makeatletter
\@removefromreset{figure}{chapter}
\makeatother
andtheautomaticrenumberingstops.Youmaythenneedtoredefinethewayinwhich
thefigurenumber(inthiscase)isprinted:
\makeatletter
\renewcommand{\thefigure}{\@arabic\c@figure}
\makeatother
(remembertodothewholejob,foreverycounteryouwanttomanipulate,within
\makeatletter
...
\makeatother
).
Thistechnique,too,maybeusedtochangewhereinamultilevelstructureacounter
isreset.Supposeyourclassnumbersfiguresashchapteri.hsectioni.hfigurei,andyou
wantfiguresnumberedperchapter,try:
\makeatletter
\@removefromreset{figure}{section}
\@addtoreset{figure}{chapter}
\renewcommand{\thefigure}{\thechapter.\@arabic\c@figure}
\makeatother
(thecommand
\@addtoreset
isapartofLaTeXitself).
chngcntr.sty
:
macros/latex/contrib/chngcntr
memoir.cls
:
macros/latex/contrib/memoir
removefr.tex
:
macros/latex/contrib/fragments/removefr.tex
(note,thisis
constructedasa“fragment”forusewithinotherpackages: loadby
\input
{removefr}
)
remreset.sty
: Distributedaspartof
macros/latex/contrib/carlisle
362 Makinglabelsfromacounter
SupposewehaveaLaTeXcounter,whichwe’vedefinedwith
\newcounter{foo}
.We
canincrementthevalueofthecounterby
\addtocounter{foo}{1}
,butthat’spretty
clunkyforanoperationthathappenssooften...sothere’sacommand
\stepcounter
{foo}
thatdoesthisspecialcaseofincreasing-by-one.
There’saninternalLaTeXvariable,the“currentlabel”,thatremembersthelast
‘labellable’thingthatLaTeXhasprocessed.Youcould(ifyouweretoinsist)setthat
valuebytherelevantTeXcommand(havingtakenthenecessaryprecautionstoensure
thattheinternalcommandworked)—butit’snotnecessary.If,insteadofeitherof
thesteppingmethodsabove,yousay
\refstepcounter{foo}
,theinternalvariableis
settothenewvalue,and(untilsomethingelsecomesalong),
\label
willrefertothe
counter.
254
C# Word - Merge Word Documents in C#.NET
Combine and Merge Multiple Word Files into One Using C#. This part illustrates how to combine three Word files into a new file in C# application.
pdf merge documents; combine pdf online
C# PDF File Split Library: Split, seperate PDF into multiple files
Split PDF document by PDF bookmark and outlines. Also able to combine generated split PDF document files with other PDF files to form a new PDF file.
all jpg to one pdf converter; break pdf file into multiple files
363 Findingifyou’reonanoddoranevenpage
Anotherquestiondiscussestheissueofgetting
\marginpar
commandstoputtheir
outputinthecorrectmarginoftwo-sideddocuments.Thisisanexampleofthegeneral
problemofknowingwhereaparticularbitoftextlies:theoutputroutineisasynchronous,
and(La)TeXwillusuallyprocessquiteabitofthe“next”pagebeforedecidingtooutput
anypage. Asaresult,the
page
counter(knowninternallyinLaTeXas
\c@page
)is
normallyonlyreliablewhenyou’reactuallyintheoutputroutine.
Thesolutionistousesomeversionofthe
\label
mechanismtodeterminewhich
sideofthepageyou’reon;thevalueofthepagecounterthatappearsina
\pageref
commandhasbeeninsertedinthecourseoftheoutputroutine,andisthereforesafe.
However,
\pageref
itselfisn’treliable:onemighthopethat
\ifthenelse{\isodd{\pageref{foo}}}{odd}{even}
woulddothenecessary,butboththebabelandhyperrefpackageshavebeenknownto
interferewiththeoutputof
\pageref
;becareful!
Thechangepagepackageneedstoprovidethisfunctionalityforitsownuse,and
thereforeprovidesacommand
\checkoddpage
;thissetsaprivate-use‘label’,andthe
pagereferencepartofthatlabelisthenexamined(inahyperref-safeway)toseta
conditional
\ifoddpage
trueifthecommandwasissuedonanoddpage.(Thememoir
classhasthesamecommand.) LaTeXuserswhoareunfamiliarwithTeX’s
\if...
commandsmayusetheifthenpackage:
\usepackage{ifthen,changepage}
...
\checkoddpage
\ifthenelse{\boolean{oddpage}}{<odd page stuff>}{<even page stuff>}
Ofcourse,the‘label’contributestoLaTeX’s“Reruntogetcross-referencesright”
errormessages...
TheKoma-Scriptclasseshavean
addmargin
*
environmentthatalsoprovidesthe
sortsoffacilitiesthatthechangepageoffers.Koma-Script’ssupportingcommand:
\ifthispageodd{<true>}{<false>}
executesdifferentthingsdependingonthepagenumber.
Thepackageifoddpageisdesignedtoprovidethesamefacility;crucially,itcan
behave “sensibly”evenifyouaretypesettingforone-sideprintingonly; ; likethe
changepageitusesa‘check’command
\checkoddpage
.Theconditional‘side’flags
aresetusing(Plain)TeXconditionals;theyaredefinedlocally,sothatyoucanminimise
theiruseofTeXworkspace—seethepackagedocumentationforthesomewhattrickyse-
quenceinvolved.Inadditionthepackageprovidesacommand
\ifoddpageoroneside
,
whichistrueonoddpagesofatwo-sidedocument,oronallpagesofaone-side
document.Usageis:
\checkoddpage
\ifoddpage
odd-side text
\else
even-side text
\fi
Theauthor’srecommendedusage(trickily)includesthewholeoperationinabox;this
hastheadvantagethatyourtestwillalwayswork,buttheusualdisadvantagethatboxes
maynotsplit. Incommonuses,thewholeworkwillbedoneinsideabox(as,for
example,inthecaseofafloat),sotheelaborateworkproposedbytheauthorisnot
necessary.
changepage.sty
:
macros/latex/contrib/changepage
ifoddpage.sty
:
macros/latex/contrib/ifoddpage
255
VB.NET TIFF: Merge and Split TIFF Documents with RasterEdge .NET
filePath As [String], docList As [String]()) TIFFDocument.Combine(filePath, docList) End to provide powerful & profession imaging controls, PDF document, tiff
.net merge pdf files; add pdf files together reader
VB.NET PowerPoint: Merge and Split PowerPoint Document(s) with PPT
Just like we need to combine PPT files, sometimes, we also want to separate a Note: If you want to see more PDF processing functions in VB.NET, please follow
build pdf from multiple files; add two pdf files together
ifthen.sty
: PartoftheLaTeXdistribution:
macros/latex/base
KOMAscriptbundle:
macros/latex/contrib/koma-script
memoir.cls
:
macros/latex/contrib/memoir
364 Howtochangetheformatoflabels
Bydefault,whenalabeliscreated,ittakesontheappearanceofthecounterlabelled,so
thelabelappearsas
\the
h
counter
i—whatwouldbeusedifyouaskedtotypesetthe
counterinyourtext.Thisisn’talwayswhatyouneed:forexample,ifyouhavenested
enumeratedlistswiththeouternumberedandtheinnerlabelledwithletters,onemight
expecttowanttorefertoitemsintheinnerlistas“2(c)”.(Remember,youcanchange
thestructureoflistitems—changethestructureoflistitems.)Thechangeisofcourse
possiblebyexplicitlabellingoftheparentandusingthatlabeltoconstructthetypeset
result—somethinglike
\ref{parent-item}(\ref{child-item})
whichwouldbebothtediousanderror-prone.What’smore,itwouldbeundesirable,
sinceyouwouldbeconstructingavisualrepresentationwhichisinflexible(youcouldn’t
changeallthereferencestoelementsofalistatonefellswoop).
LaTeXinfacthasalabel-formattingcommandbuiltintoeverylabeldefinition;
bydefaultit’snull,butit’savailablefortheusertoprogram.Foranylabelhcounteri
there’saLaTeXinternalcommand
\p@
h
counter
i;forexample,alabeldefinitionon
aninnerlistitemissupposedlydoneusingthecommand
\p@enumii{\theenumii}
.
Unfortunately,theinternalworkingsofthisaren’tquiteright,andyouneedtopatchthe
\refstepcounter
command:
\renewcommand
*
\refstepcounter[1]{\stepcounter{#1}%
\protected@edef\@currentlabel{%
\csname p@#1\expandafter\endcsname
\csname the#1\endcsname
}%
}
Withthepatchinplaceyoucannow,forexample,changethelabelsonallinnerlistsby
addingthefollowingcodeinyourpreamble:
\makeatletter
\renewcommand{\p@enumii}[1]{\theenumi(#1)}
\makeatother
Thiswouldmakethelabelsforsecond-levelenumeratedlistsappearas“1(a)”(andso
on).Theanalogouschangeworksforanycounterthatgetsusedina
\label
command.
Infact,thefncylabpackagedoesalltheabove(includingthe patchtoLaTeX
itself).Withthepackage,thecodeaboveis(actuallyquiteefficiently)renderedbythe
command:
\labelformat{enumii}{\theenumi(#1)}
Infact,theaboveexample,whichwecandoinseveraldifferentways,hasbeenrendered
obsoletebytheappearanceoftheenumitempackage,whichisdiscussedintheanswer
aboutdecoratingenumerationlists.
enumitem.sty
:
macros/latex/contrib/enumitem
fncylab.sty
:
macros/latex/contrib/fncylab
365 Adjustingthepresentationofsectionnumbers
Thegeneralissuesofadjustingtheappearanceofsectionheadingsareprettycomplex,
andarecoveredinquestionthestyleofsectionheadings.
However,peopleregularlywantmerelytochangethewaythesectionnumber
appearsintheheading,andsomesuchpeopledon’tmindwritingoutafewmacros.
Thisanswerisforthem.
256
ThesectionnumberistypesetusingtheLaTeXinternal
\@seccntformat
command,
whichisgiventhe“name”(section,subsection,...) oftheheading,asargument.
Ordinarily,
\@seccntformat
merelyoutputsthesectionnumber,andthena
\quad
of
space:
\renewcommand
*
{\@seccntformat}[1]{%
\csname the#1\endcsname\quad
}
Supposeyouwanttoputastopaftereverysection(subsection,subsubsection,...)
number,atrivialchangemaybeimplementedbysimplemodificationofthecommand:
\renewcommand
*
{\@seccntformat}[1]{%
\csname the#1\endcsname.\quad
}
However,manypeoplewanttomodifysectionnumbers,butnotsubsectionnumbers,or
anyoftheothers.Todothis,onemustmake
\@seccntformat
switchaccordingtoits
argument.Thefollowingtechniquefordoingthejobisslightlywasteful,butisefficient
enoughforarelativelyrareoperation:
\renewcommand
*
{\@seccntformat}[1]{%
\csname the#1\endcsname
\csname adddot@#1\endcsname\quad
}
whichusesasecond-levelcommandtoprovidethedot,ifithasbeendefined;otherwise
itmerelyappends
\relax
(whichdoesnothinginthiscontext).Thedefinitionofthe
second-levelcommand(theversionforthe
section
,here)specifieswhattoputaftera
sectionnumber,butitcouldbeusedtoputanythingafterit:
\newcommand
*
{\adddot@section}{.}
NotethatallthecommanddefinitionsabovearedealinginLaTeXinternalcommands,
sotheabovecodeshouldbeinapackagefile,forpreference.
TheKoma-scriptclasseshavedifferentcommandsforspecifyingchangestosection
numberpresentation:
\partformat
,
\chapterformat
and
\othersectionlevelsformat
,
butotherwisetheirfacilitiesaresimilartothoseof“raw”LaTeX.
KOMAscriptbundle:
macros/latex/contrib/koma-script
366 There’saspaceaddedaftermyenvironment
You’vewrittenyourownenvironment
env
,anditworksexceptthataspaceappears
atthestartofthefirstlineoftypesettextafter
\end{env}
.Thisdoesn’thappenwith
similarLaTeX-suppliedenvironments.
Youcouldimposetherestrictionthatyourusersalwaysputa“
%
”signafterthe
environment... butLaTeXenvironmentsdon’trequirethat,either.
TheLaTeXenvironments’“secret”isaninternalflagwhichcausestheunwanted
spacestobeignored.Fortunately,youdon’thavetousetheinternalform:since1996,
LaTeXhashadausercommand
\ignorespacesafterend
,whichsetstheinternalflag.
367 Findingifalabelisundefined
Peopleseemtowanttoknow(atruntime)ifalabelisundefined(Idon’tactually
understandwhy,particularly:it’satransientstate,andLaTeXdealswithitquitewell).
Aresolvedlabelissimplyacommand:
\r@
h
label-name
i;determiningifthelabel
issetisthensimplyamatterofdetectingifthecommandexists. TheusualLaTeX
internalwayofdoingthisistousethecommand
\@ifundefined
:
\@ifundefined{r@label-name}{undef-cmds}{def-cmds}
257
Inwhich,hlabel-nameiisexactlywhatyouwoulduseina
\label
command,andthe
remainingtwoargumentsarecommandsequencestobeusedifthelabelisundefined
(hundef-cmdsi)orifitisdefined(hdef-cmdsi).
Notethatanycommandthatincorporates
\@ifundefined
isnaturallyfragile,so
remembertocreateitwith
\DeclareRobustCommand
ortouseitwith
\protect
ina
movingargument.
Ifyou’reintothisgame,youmaywellnotcareaboutLaTeX’swarningabout
undefinedlabelsattheendofthedocument;however,ifyouare,includethecommand
\G@refundefinedtrue
inh
undef-cmds
i.
Andofcourse,rememberyou’redealingininternalcommands,andpayattentionto
theat-signs.
Alltheabovecanbeavoidedbyusingthelabelcaspackage:itprovidescommands
thatenableyoutoswitchaccordingtothestateofasinglelabel,orthestatesofalist
oflabels.Thepackage’sdefinitionisabitcomplicated,butthepackageitselfispretty
powerful.
labelcas.sty
:
macros/latex/contrib/labelcas
368 Masterandslavecounters
It’scommontohavethingsnumbered“perchapter”(forexample,inthestandardbook
andreportclasses,figures,tablesandfootnotesareallnumberedthus).Theprocess
ofresettingisdoneautomatically,whenthe“master”counterisstepped(whenthe
\chapter
commandthatstartschapterhnihappens,the
chapter
counterisstepped,
andallthedependentcountersaresettozero).
Howwouldyoudothatforyourself? Youmightwanttonumberalgorithmsper
section,orcorollariespertheorem,forexample.Ifyou’redefiningthesethingsbyhand,
youdeclaretherelationshipwhenyoudefinethecounterinthefirstplace:
\newcounter{new-name}[master]
saysthateverytimecounterhmasteriisstepped,counterhnew-nameiwillbereset.
Butwhatifyouhaveanuncooperativepackage,thatdefinestheobjectsforyou,but
doesn’tprovideaprogrammerinterfacetomakethecountersbehaveasyouwant?
The
\newcounter
commandusesaLaTeXinternalcommand,andyoucanalsouse
it:
\@addtoreset{new-name}{master}
(butrememberthatitneedstobebetween
\makeatletter
and
\makeatother
,orina
packageofyourown).
Thechngcntrpackageencapsulatesthe
\@addtoreset
commandintoacommand
\counterwithin
.So:
\counterwithin
*
{corrollary}{theorem}
willmakethecorollarycounterslavetotheoremcounters.Thecommandwithoutits
asterisk:
\counterwithin{corrollary}{theorem}
willdothesame,andalsoredefine
\thecorollary
ashtheoremnumberi.hcorollary
numberi,whichisagoodschemeifyoueverwanttorefertothecorollaries—thereare
potentiallymany“corollary1”inanydocument,soit’saswelltotieitsnumbertothe
counterofthetheoremitbelongsto.Thisistrueofprettymuchanysuchcounter-within-
another;ifyou’renotusingthechngcntr,refertotheanswertoredefiningcounters’
\the-
commandsforthenecessarytechniques.
Notethatthetechniquedoesn’tworkifthemastercounteris
page
,thenumberofthe
currentpage.The
page
counterissteppeddeepinsidetheoutputroutine,whichusually
getscalledsometimeafterthetextforthenewpagehasstartedtoappear:sospecial
techniquesarerequiredtodealwiththat. Onespecialcaseisdealtwithelsewhere:
footnotesnumberedperpage.Oneofthetechniquesdescribedthere,usingpackage
perpage,maybeappliedtoanycounter.Thecommand:
258
\MakePerPage{counter}
willcausehcounteritoberesetforeachpage.Thepackageusesalabel-likemechanism,
andmayrequiremorethanonerunofLaTeXtostabilisecountervalues—LaTeXwill
generatetheusualwarningsaboutlabelschanging.
chngcntr.sty
:
macros/latex/contrib/chngcntr
perpage.sty
: Distributedaspart
macros/latex/contrib/bigfoot
369 Fontsatarbitrarysizes
Almostallfonts,nowadays,areprovidedwithLaTeXcontrol(
.fd
)files,sothetempta-
tiontorisktheproblemsof
\newfont
isusuallyeasytoresist.
However,onetemptationremains,arisingfromthewaythatLaTeXrestrictsthe
sizesoffonts. Infact,therestrictiononlysignificantlyappliestothedefault(Com-
puterModern)andtheCork-encoded(T1)ECfonts,butitiswidelyconsideredtobe
anomalous,nowadays.Inrecognitionofthisproblem,thereisapackagefix-cmwhich
willallowyoutousethefonts,withinLaTeX,atanysizeyouchoose.Ifyou’renot
usingscaleableversionsofthefonts,mostmoderndistributionswilljustgeneratean
appropriatebitmapforyou.
So,supposeyouwanttoproduceaheadinginComputerModernRomanat30
points,youmightbetemptedtowrite:
\newfont{\bigfont}{cmr10 at 30pt}
\begin{center}
\bigfont Huge text
\end{center}
whichwillindeedwork,butwillactuallyproduceaworseresultthan
\usepackage{fix-cm}
...
\begin{center}
\fontsize{30}{36}\selectfont
Huge text
\end{center}
Notethatthefix-cmpackagewasnotdistributeduntiltheDecember2003editionof
LaTeX;ifyouhaveanolderdistribution,thepackagestype1cm(forCMfonts)and
type1ec(forECfonts)areavailable.
Fix-cmdoesn’thasoneortwoomissions—fontstheLaTeXteamdidnotconsider
useful,orsomething;theCMdunhillfonts(asCM,butwithstretchedascenders)andthe
CMfibonaccifont(whichisonlyavailablein8-pointdesignsize)arecertainlymissing.
Iffix-cmdoesn’tdothejob,trythetype1xxpackages,ortheanyfontsizepackage.
AfurtheralternativemightbetoswitchtotheLatinModernfonts(whichprovidea
closesimulacrumoftheComputerModernset);thesefontswerescaleablefromtheir
firstdistribution,anddon’tthereforeneedanysuchtrickastheabove.
anyfontsize.sty
:
macros/latex/contrib/anyfontsize
fix-cm.sty
Distributedaspartof
macros/latex/base
(anunpackedversionis
availableat
macros/latex/unpacked/fix-cm.sty
)
LatinModernfonts:
fonts/lm
type1cm.sty
:
macros/latex/contrib/type1cm
type1ec.sty
:
fonts/ps-type1/cm-super/type1ec.sty
(thepackageisactually
partofthe
fonts/ps-type1/cm-super
distribution,butitworkshappilyin
theabsenceofthescaledfonts)
259
370 ThequalityofyourLaTeX
Thel2tabututorial(mentionedinonlineintroductions)isundoubtedlyagoodread.
However,it’salwaysdifficulttorememberthethingsyoushouldnotdo,whenthere
aresomanythingstorememberthatyoureallymustdo:someautomationisuseful....
Thenicely-namednagallowsyoutoapplyaconfigurablesetofcheckstoyour
document,asyourunitthroughLaTeX;yougetmessageslike:
Package nag g Warning: Command \bf is s an old d LaTeX X 2.09 command.
(nag)
Use \bfseries or \textbf f instead on n input t line 30.
(thepackageprovidesademofilewhichcontainsmostofthesortsoferrorsyoumight
make—theexampleisoneofthem). Whilel2tabuandnagalertyoutopossible
programmingerrors,youshouldnotforgetthattheyaremerelycommentingonstyle;
don’tassumethatanagerrorisgoingtodamnyourcode—rather,notetheissueand
trytotrainyourfingersnottodothesame“nexttime”.
Thelacheckprogramanalysesyoursourceandcommentsonit;itsviewofwhatis
“bad”isverysubjective(thedocumentationsays),butitcanbeuseful.
There’salsoawebsiteTeXidatewhichwilldoastaticanalysisofyourdocument
(unfortunately,youhavetopasteyourdocumentsourceintoatextwindow).Thesite
doesn’tseemascomprehensiveasnag,butitallowsyoutodownloaditsscript,which
youcanthenjugglewithtomakeitmoredraconian.
l2tabu
Browse
info/l2tabu
foracopyofthedocumentinalanguagethatis
convenientforyou
lacheck
:
support/lacheck
nag.sty
:
macros/latex/contrib/nag
371 ProcessaCSVfileinLaTeX
Comma-separated-variable(CSV)filesareacommonmeansofinterchangingsimple
databetweenapplications;forexample,mostspreadsheetapplicationscanprovidefiles
containingtablesofnumberswithcommasbetweenthem.Onecanenvisagethesetables
as“LaTeXtables”,andthepackagestoprocessthemallprovidetablegeneration,one
wayoranother.
Forratheralongtime,thecanonicaltoolsfordealingwithsuchfileshavebeen
thoseprovidedinthedatatoolbundle;packagesinthebundleallowtheusertowrite
procedurestoprocessnumbers,currencyamounts,names,etc.,andtodisplaythemin
tables(includingpiecharts).
Thecsvsimpledoessimilartasks.Itsprocessingiscontrolledbykeysestablished
viathepgfkeyspackage,whichdefinehoweachrowoftheCSVfileistobeprocessed.
Forusage“nearertothebone”,onemightconsiderthecommands
\docsvlist
and
\forcsvlist
(fromtheetoolboxpackage).Thefirstusesthetime-honouredLaTeX
techniqueofchangingthedefinitionofa
\do
command;itrunsthroughthelist,and
processeseveryitemofthelistastheargumentofthe
\do
command;so:
\begin{itemize}
\renewcommand
*
{\do}[1]{\item #1}
\docsvlist{item1, item2, {item3a, item3b}, item4}
\end{itemize}
willconverttheelementsofaCSVlistintoanitemisedlist.
Themacro
\forcsvlist
appliesafunctiontoeachelementofaCSVlist;thiscan
ofcoursebeusedtoimplement
\docsvlist
,atthecostofalittleclarity.
csvsimple.sty
:
macros/latex/contrib/csvsimple
datatool
bundle:
macros/latex/contrib/datatool
etoolbox.sty
:
macros/latex/contrib/etoolbox
pgfkeys.sty
: Distributedaspartof
graphics/pgf/base
260
Documents you may be interested
Documents you may be interested