.net c# pdf viewer : C# merge pdf files Library control component asp.net web page winforms mvc letterfaq26-part541

S ThingsareGoingWrong...
S.1 Gettingthingstofit
372 EnlargingTeX
TheTeXerrormessage‘capacityexceeded’coversamultitudeofproblems.Whathas
beenexhaustedislistedinbracketsaftertheerrormessageitself,asin:
! TeX capacity exceeded, sorry
...
[main memory y size=263001].
MostofthetimethiserrorcanbefixedwithoutenlargingTeX.Themostcommoncauses
areunmatchedbraces,extra-longlines,andpoorly-writtenmacros.Extra-longlinesare
oftenintroducedwhenfilesaretransferredincorrectlybetweenoperatingsystems,and
line-endingsarenotpreservedproperly(thetell-talesignofanextra-longlineerroris
thecomplaintthatthe‘
buf_size
’hasoverflowed).
IfyoureallyneedtoextendyourTeX’scapacity,thepropermethoddependson
yourinstallation.Thereisnoneed(withmodernTeXimplementations)tochangethe
defaultsinKnuth’sWEBsource;butifyoudoneedtodoso,useachangefiletomodify
thevaluessetinmodule11,recompileyourTeXandregenerateallformatfiles.
ModernimplementationsallowthesizesofthevariousbitsofTeX’smemorytobe
changedsemi-dynamically.Some(suchasemTeX)allowthememoryparameterstobe
changedincommand-lineswitcheswhenTeXisstarted;mostfrequently,aconfiguration
fileisreadwhichspecifiesthesizeofthememory.Onweb2c-basedsystems,thisfile
iscalled
texmf.cnf
:seethedocumentationthatcomeswiththedistributionforother
implementations.Almostinvariably,aftersuchachange,theformatfilesneedtobe
regeneratedafterchangingthememoryparameters.
373 Whycan’tIloadPiCTeX?
PiCTeXisaresourcehog;fortunately,mostmodernTeXimplementationsoffergenerous
amountsofspace,andmostmoderncomputersareprettyfast,sousersaren’ttoobadly
affectedbyitsperformance.
However,PiCTeXhasthefurtherunfortunatetendencytofillupTeX’sfixed-size
arrays—notablythearrayof256‘dimension’registers.Thisisaparticularproblem
whenyou’reusing
pictex.sty
withLaTeXandsomeotherpackagesthatalsoneed
dimensionregisters.Whenthishappens,youwillseetheTeXerrormessage:
! No o room m for r a a new \dimen.
Thereisnothingthatcandirectlybedoneaboutthiserror:youcan’textendthenumber
ofavailable
\dimen
registerswithoutextendingTeXitself.Omegaande-TeXbothdo
this.
It’sactuallyquitepractical(withmostmoderndistributions)tousee-TeX’sextended
registerset:usepackageetex(whichcomeswithe-TeXdistributions)andtheallocation
mechanismisalteredtocopewiththelargerregisterset:PiCTeXwillnowload.
Ifyou’reinsomesituationwhereyoucan’tusee-TeX,youneedtochangePiCTeX;
unfortunatelyPiCTeX’sauthorisnolongeractiveintheTeXworld,soonemustresort
topatching.Therearetwosolutionsavailable.
TheConTeXtmodule
m-pictex.tex
(forPlainTeXandvariants)orthecorre-
spondingLaTeXm-pictexpackageprovideaningenioussolutiontotheproblembased
onhackingthecodeof
\newdimen
itself.
Alternatively,AndreasSchrell’spictexwdandrelatedpackagesreplacePiCTeXwith
aversionthatuses33fewer
\dimen
registers;sousepictexwdinplaceofpictex(either
asaLaTeXpackage,orasafiletoreadintoPlainTeX).
AndhowdoesoneusePiCTeXanyway,giventhatthemanualissohardtocome
by?Fortunatelyforusall,theMathsPicsystemmaybeusedtotranslateasomewhat
differentlanguageintoPiCTeXcommands;andtheMathsPicmanualisfree(andpart
ofthedistribution).MathsPicisavailableeitherasaBasicprogramforDOS,orasa
Perlprogramforothersystems(includingWindows,nowadays).
261
C# merge pdf files - Merge, append PDF files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provide C# Demo Codes for Merging and Appending PDF Document
pdf combine files online; scan multiple pages into one pdf
C# merge pdf files - 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
batch combine pdf; pdf combine two pages into one
etex.sty
:
macros/latex/contrib/etex-pkg
m-pictex.sty
: Distributedaspartof
macros/context/current/cont-tmf.zip
m-pictex.tex
: Distributedaspartof
macros/context/current/cont-tmf.zip
MathsPic
:
graphics/mathspic
pictexwd.sty
: Distributedaspartof
graphics/pictex/addon
S.2 Makingthingsstaywhereyouwantthem
374 MovingtablesandfiguresinLaTeX
Tablesandfigureshaveatendencytosurprise,byfloatingawayfromwheretheywere
specifiedtoappear.Thisisinfactperfectlyordinarydocumentdesign;anyprofessional
typesettingpackagewillfloatfiguresandtablestowherethey’llfitwithoutviolating
thecertaintypographicrules.Evenifyouusetheplacementspecifier”
h
”(for‘here’),
thefigureortablewillnotbeprinted‘here’ifdoingsowouldbreaktherules;therules
themselvesareprettysimple,andaregivenonpage198,sectionC.9oftheLaTeX
manual. Intheworstcase,LaTeX’srulescancausethefloatingitemstopileupto
theextentthatyougetanerrormessagesaying“Toomanyunprocessedfloats”.What
followsisasimplechecklistofthingstodotosolvetheseproblems(thechecklisttalks
throughoutaboutfigures,butappliesequallywelltotables,orto“non-standard”floats
definedbythefloatorotherpackages).
• Doyourfiguresneedtofloatatall? Ifnot,lookattherecommendationsfor
non-floatingfloats
• Aretheplacementparametersonyourfiguresright?Thedefault(“
tbp
”)isusually
satisfactory,butyoucanreasonablychangeit(forexample,toaddan“
h
”).What-
everyoudo,don’tomitthe“
p
”:doingsocouldcauseLaTeXtobelievethatifyou
can’thaveyourfigurehere,youdon’twantitanywhere.(LaTeXdoestrytoavoid
beingconfusedinthisway...)
• LaTeX’sownfloatplacementparameterscouldbepreventingplacementsthat
seementirely“reasonable”toyou—they’renotoriouslyratherconservative.To
encourageLaTeXnottomoveyourfigure,youmayneedtoloosenitsdemands.
(Themostimportantonesaretheratiooftexttofloatonagivenpage,butit’s
sensibletohaveafixedsetthatchangesthewholelot,tomeeteveryeventuality.)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
Themeaningsoftheseparametersaredescribedonpages199–200,sectionC.9of
theLaTeXmanual.
• Arethereplacesinyourdocumentwhereyoucould‘naturally’puta
\clearpage
command?Ifso,do:thebacklogoffloatsisclearedaftera
\clearpage
.(Notethat
the
\chapter
commandinthestandardbookandreportclassesimplicitlyexecutes
\clearpage
,soyourfloatscan’twanderpasttheendofachapter.)
• Trytheplaceinspackage:itdefinesa
\FloatBarrier
commandbeyondwhich
floatsmaynotpass.Apackageoptionallowsyoutodeclarethatfloatsmaynotpass
a
\section
command,butyoucanplace
\FloatBarrier
swhereveryouchoose.
• Ifyouarebotheredbyfloatsappearingatthetopofthepage(beforetheyare
specifiedinyourtext),trytheflafterpackage,whichavoidsthisproblembyinsisting
thatfloatsshouldalwaysappearaftertheirdefinition.
• HavealookattheLaTeX2eafterpagepackage. Itsdocumentationgivesasan
exampletheideaofputting
\clearpage
afterthecurrentpage(whereitwillclear
262
Online Merge PDF files. Best free online merge PDF tool.
Thus, C#.NET PDF document merge library control can be counted as an efficient .NET doc solution for keeping PDF document files organized. Download Free Trial.
append pdf files reader; pdf merge files
C# PDF File Split Library: Split, seperate PDF into multiple files
outputFiles); Split PDF Document into Multiple PDF Files in C#. You can use the following C# demo to split PDF document to four files.
reader combine pdf pages; c# merge pdf files into one
thebacklog,butnotcauseanuglygapinyourtext),butalsoadmitsthatthepackage
issomewhatfragile.Useitasalastresortiftheotherpossibilitiesbelowdon’thelp.
• Ifyouwouldactuallylikegreatblocksoffloatsattheendofeachofyourchapters,
trythemorefloatspackage;thisallowsyoutoincreasethenumberoffloatinginserts
thatLaTeXcanhandleatonetime(fromitsoriginalvalueof18,inLaTeX2e).
Notethat,evenwithe-TeX’sgreatersupplyofregisters,thereisstillamodest
limitonthetotalnumberoffloatinginserts(e-TeXincreasesthetotalnumberof
registersavailable,butinsertsdon’tworkiftheyareconstructedfromregistersin
theextendedrange).
Caveat:ifyouareusingetextoincreasethenumberofregistersavailable,youneed
to“reserve”someinsertsformorefloats:somethinglike:
\usepackage{etex}
\reserveinserts{18}
\usepackage{morefloats}
• Ifyouactuallywantedallyourfigurestofloattotheend(e.g.,forsubmittingadraft
copyofapaper),don’trelyonLaTeX’smechanism:gettheendfloatpackagetodo
thejobforyou.
afterpage.sty
: Distributedaspartof
macros/latex/required/tools
endfloat.sty
:
macros/latex/contrib/endfloat
etex.sty
:
macros/latex/contrib/etex-pkg
flafter.sty
: PartoftheLaTeXdistribution
float.sty
:
macros/latex/contrib/float
morefloats.sty
:
macros/latex/contrib/morefloats
placeins.sty
:
macros/latex/contrib/placeins
375 Underlinedtextwon’tbreak
Knuthmadenoprovisionforunderliningtext:hetooktheviewthatunderliningisnot
atypesettingoperation,butratheronethatprovidesemphasisontypewriters,which
typicallyofferbutonetypeface.Thecorrespondingtechniqueintypesettextistoswitch
fromuprighttoitalictext(orvice-versa):theLaTeXcommand
\emph
doesjustthatto
itsargument.
Nevertheless,typographicallyilliteratepeople(suchasthosethatspecifydouble-
spacedthesisstyles—thesisstyles)continuetorequireunderliningofus,soLaTeXas
distributeddefinesan
\underline
commandthatappliesthemathematical‘underbar’
operationtotext.Thistechniqueisnotentirelysatisfactory,however:thetextgetsstuck
intoabox,andwon’tbreakatlineend.
Twopackagesareavailablethatsolvethisproblem.Theulempackageredefinesthe
\emph
commandtounderlineitsargument;theunderlinedtextthusproducedbehavesas
ordinaryemphasisedtext,andwillbreakovertheendofaline.(Thepackageiscapable
ofotherpeculiareffects,too:readitsdocumentation.)Thesoulpackagedefinesan
\ul
command(afterwhichthepackageis,inpart,named)thatunderlinesrunningtext.
Bewareofulem’sdefaultbehaviour,whichistoconvertthe
\emph
commandinto
anunderliningcommand;thiscanbeavoidedbyloadingthepackagewith:
\usepackage[normalem]{ulem}
ulem.sty
:
macros/latex/contrib/ulem
soul.sty
:
macros/latex/contrib/soul
376 Controllingwidowsandorphans
Widows(thelastlineofaparagraphatthestartofapage)andorphans(thefirstlineof
paragraphattheendofapage)interruptthereader’sflow,andaregenerallyconsidered
“badform”;(La)TeXtakessomeprecautionstoavoidthem,butcompletelyautomatic
preventionisoftenimpossible.Ifyouaretypesettingyourowntext,considerwhether
263
C# PDF Convert to HTML SDK: Convert PDF to html files in C#.net
How to Use C#.NET Demo Code to Convert PDF Document to HTML5 Files in C#.NET Class. Add necessary references: RasterEdge.Imaging.Basic.dll.
batch pdf merger; break a pdf into multiple files
C# PDF Convert to Jpeg SDK: Convert PDF to JPEG images in C#.net
toolkit, C# developers can easily and quickly convert a large-size multi-page PDF document to a group of high-quality separate JPEG image files within .NET
c# merge pdf; split pdf into multiple files
youcanbringyourselftochangethewordingslightlysothatthepagebreakwillfall
differently.
The (La)TeX X page maker, when forming a page, takes s account of variables
\widowpenalty
and
\clubpenalty
(whichrelatestoorphans!).Thesepenaltiesare
usuallysettothemoderatevalueof
150
;thisoffersmilddiscouragementofbadbreaks.
Youcanincreasethevaluesbysaying(forexample)
\widowpenalty=500
;however,
verticallists(suchaspagesaremadeof)typicallyhaveratherlittlestretchabilityor
shrinkability,soifthepagemakerhastobalancetheeffectofstretchingtheunstretch-
ableandbeingpenalised,thepenaltywillseldomwin.Therefore,fortypicallayouts,
thereareonlytwosensiblesettingsforthepenalties:finite(150or500,itdoesn’tmatter
which)toallowwidowsandorphans,andinfinite(10000orgreater)toforbidthem.
Theproblemcanbeavoidedbyallowingthepagemakertorunpagesshort,by
usingthe
\raggedbottom
directive;however,manypublishersinsistonthedefault
\flushbottom
;itisseldomacceptabletointroducestretchabilityintotheverticallist,
exceptatpoints(suchassectionheadings)wherethedocumentdesignexplicitlypermits
it.
Onceyou’veexhaustedtheautomaticmeasures,andhaveafinaldraftyouwantto
“polish”,youshouldproceedtomanualmeasures.Togetridofanorphanissimple:
precedetheparagraphwith
\clearpage
andtheparagraphcan’tstartinthewrong
place.
Gettingridofawidowcanbemoretricky.Optionsare
• Ifthepreviouspagecontainsalongparagraphwithashortlastline,itmaybe
possibletosetit‘tight’:write
\looseness=-1
immediatelyafterthelastwordof
theparagraph.
• Ifthatdoesn’twork,adjustingthepagesize,using
\enlargethispage{\baselineskip}
to‘addaline’tothepage,whichmayhavetheeffectofgettingthewholeparagraph
ononepage.
• Reducingthesizeofthepageby
\enlargethispage{-\baselineskip}
may
producea(more-or-less)acceptable“two-linewidow”.
Notethat
\looseness=1
(whichshouldincreasethelinelengthbyone)seldomhasthe
righteffect—thelooserparagraphtypicallyhasaone-wordfinalline,whichdoesn’t
lookmuchbetterthantheoriginalwidow.
S.3 Thingshave“goneaway”
377 OldLaTeXfontreferencessuchas
\tenrm
LaTeX2.09definedalargesetofcommandsforaccesstothefontsthatithadbuiltinto
itself.Forexample,cmrmightappearas
\fivrm
,
\sixrm
,
\sevrm
,
\egtrm
,
\ninrm
,
\tenrm
,
\elvrm
,
\twlrm
,
\frtnrm
,
\svtnrm
,
\twtyrm
and
\twfvrm
,accordingtothe
sizeit’sbeingtypesetat.Thesecommandswereneverdocumented,butcertainpackages
neverthelessusedthemtoachieveeffectstheyneeded.
Sincethecommandsweren’tpublic,theyweren’tincludedinLaTeX2e;touse
theunconvertedLaTeX2.09packagesunderLaTeX2e,youneedalsotoincludethe
rawfontspackage(whichispartoftheLaTeX2edistribution).
378 Missingsymbolcommands
You’reprocessinganolddocument,andsomesymbolcommandssuchas
\Box
and
\lhd
appearnolongertoexist.ThesecommandswerepresentinthecoreofLaTeX2.09,
butarenotincurrentLaTeX.Theyareavailableinthelatexsympackage(whichispart
oftheLaTeXdistribution),andintheamsfontspackage(whichispartoftheAMS
distribution,andrequiresAMSsymbolfonts).
AMSfonts
:
fonts/amsfonts
379 Wherearethe
msx
and
msy
fonts?
ThemsxandmsyfontsweredesignedbytheAmericanMathematicalSocietyinthevery
earlydaysofTeX,foruseintypesettingpapersformathematicaljournals.Theywere
designedusingthe‘old’Metafont,whichwasn’tportableandisnolongeravailable;for
264
C# PDF Convert to SVG SDK: Convert PDF to SVG files in C#.net, ASP
file using C#. Instantly convert all PDF document pages to SVG image files in C#.NET class application. Perform high-fidelity PDF
reader combine pdf; acrobat reader merge pdf files
C# PDF Convert to Text SDK: Convert PDF to txt files in C#.net
content of target PDF document can be copied and pasted to .txt files by keeping original layout. C#.NET class source code for converting each PDF document page
add pdf pages together; apple merge pdf
alongtimetheywereonlyavailablein300dpiversionswhichonlyimperfectlymatched
modernprinters.TheAMShasnowredesignedthefonts,usingthecurrentversionof
Metafont,andthenewversionsarecalledthemsaandmsbfamilies.
Nevertheless,msxandmsycontinuetoturnup.Theremay,ofcourse,stillbesites
thathaven’tgotaroundtoupgrading;but,evenifeveryoneupgraded,therewouldstill
betheproblemofolddocumentsthatspecifythem.
Ifyouhavea
.tex
sourcethatrequestsmsxandmsy,thebesttechniqueistoeditit
sothatitrequestsmsaandmsb(youonlyneedtochangethesingleletterinthefont
names).
Apartialre-implementationoftheblackboard-boldpartofthemsyfont(covering
C,N,R,SandZ,only)isavailableinType1format;ifyourmathematicalneedsonly
extendthatfar,thefontcouldbeagoodchoice.
IfyouhaveaDVIfilethatrequeststhefonts,thereisapackageofvirtualfontsto
maptheoldtothenewseries.
msam&msbm
fonts: Distributedaspartof
fonts/amsfonts
msym
fonts:
fonts/msym
virtualfontset:
fonts/vf-files/msx2msa
380 Wherearethe
am
fonts?
Onestilloccasionallycomesacrossarequestfortheamseriesoffonts.Theinitials
stoodfor‘Almost[Computer]Modern’,andtheywerethepredecessorsoftheComputer
Modernfontsthatweallknowandlove(orhate)
3
.There’snotalotonecandowith
thesefonts;theyare(astheirnameimplies)almost(butnotquite)thesameasthecm
series;ifyou’refacedwithadocumentthatrequeststhem,theonlyreasonableapproach
istoeditthedocumenttoreplaceam*fontnameswithcm*.
TheappearanceofDVIfilesthatrequestthemissufficientlyrarethatno-onehas
undertakenthemammothtaskofcreatingatranslationofthembymeansofvirtual
fonts.
Youthereforehavetofoolthesystemintousingcm*fontswheretheoriginalauthor
specifiedam*.
OneoptionisthefontsubstitutionsthatmanyDVIdriversprovideviatheirconfig-
urationfile—specifythateveryamfontshouldbereplacedbyitscorrespondingcm
font.
Alternatively,onemaytryDVIediting—packagesdtl(DVITextLanguage)and
dviasm(DVIassembler)canbothprovideroundtripsfromDVItotextandbacktoDVI.
Onethereforeeditsfontnames(throughoutthetextrepresentationofthefile)inthe
middleofthatroundtrip.
TheDTLtextisprettystraightforward,forthispurpose:fontnamesareinsingle
quotesattheendoflines,so:
dv2dt -o
hdoc.txtihdoc.dvii
(editthe
.txt
file)
dt2dv -o
hedited.dviihedited.txti
(youhavetocompiletheCprogramsforthis).
DviasmisaPythonscript;itsoutputhasfontnamesinasectionnearthestartofthe
document,andthendottedaboutthroughthebody,so:
python dviasm.py y -o
hdoc.txtihdoc.dvii
(editthe
.txt
file)
python dviasm.py y -o
hedited.dviihedited.txti
Bothroutesseemacceptablewaysforward;itisamatteroftastewhichanyparticular
usermaychoose(it’snotlikelythatitwillbenecessaryveryoften...).
3
Thefontsacquiredtheirlabel‘Almost’followingtherealisationthattheirfirstimplementationinMeta-
font79stillwasn’tquiteright;Knuth’soriginalintentionhadbeenthattheywerethefinalanswer.
265
C# PDF Image Extract Library: Select, copy, paste PDF images in C#
C#.NET extract image from multiple page adobe PDF file Extract various types of image from PDF file, like JPG, JPEG and other high quality image files from PDF
append pdf; how to combine pdf files
C# PDF Text Extract Library: extract text content from PDF file in
image files. Enable extracting PDF text to another PDF file, TXT and SVG formats. Support extracting OCR text from PDF by working with XImage.OCR SDK. Best C#.NET
acrobat merge pdf; add pdf files together
dviasm.py
:
dviware/dviasm
dtl
:
dviware/dtl
381 What’shappenedtoinitex?
Inthebeginning,(La)TeXwasstretchingthecapacityofeverysystemitwasportedto,
sotherewasapremiumonreducingthesizeofexecutables.Onewayofdoingthiswas
tohaveaseparateexecutable,initex,thathadthingsinitthataren’tneededinordinary
documentruns—notably
\patterns
(whichbuildshyphenationtables),and
\dump
(whichwritesoutaformat).
Onmodernsystems,thesizeofthiscodeisinsignificantincomparisontothe
memoryavailable,andmaintainingseparateprogramshasbeenfoundsufficientlyerror-
pronethatfreeUnix-stylesystemdistributionshaveabolishedinitexanditsfriendsand
relationssuchasinipdftexinfavourofasingleexecutable(thatis,justtexorpdftex)that
will“dowhatinitex(orwhatever)usedtodo”ifitdetectsthecommandoption“
-ini
”.
ThechangehappenedwiththeadventofteTeXversion3.0,whichappearedatthe
beginningof2005.Atthattime,TeXLivewasfollowingteTeX,sothatyear’sTeXLive
distributionwouldalsohavedroppedinitex.
ItwouldappearthattheequationissomewhatdifferentfortheMiKTeXdevelopers,
sincethatsystemcontinuestoofferaninitexexecutable.
T Whydoesitdothat?
T.1 Commonerrors
382 LaTeXgetscross-referenceswrong
Sometimes,howevermanytimesyourunLaTeX,thecross-referencesarejustwrong.A
likelyreasonisthatyouhaveplacedthelabelbeforethedataforthelabelwasset;ifthe
labelisrecordinga
\caption
command,the
\label
commandmustappearafterthe
\caption
command,orbepartofit.Forexample:
\begin{figure}
<the illustration itself>
\caption{My figure}
\label{myfig}
\end{figure}
iscorrect,asis
\begin{figure}
<the illustration itself>
\caption{My figure%
\label{myfig}}
\end{figure}
whereas,in
\begin{figure}
<the illustration itself>
\label{myfig}
\caption{My figure}
\end{figure}
thelabelwillreportthenumberofthesection(orwhatever)inwhichthesurrounding
textresides,orthelike.
Youcan,withthesamemaligneffect,shieldthe
\caption
commandfromits
associated
\label
command,byenclosingthecaptioninanenvironmentofitsown.
Thiseffectwillbeseenwith:
266
\begin{figure}
<the illustration itself>
\caption{A Figure}
\end{figure}
\label{myfig}
wherethe
\label
definitelyisafterthe
\caption
,butbecausethe
figure
environment
closedbeforethe
\label
command,the
\caption
isnolonger“visible”.
Insummary,the
\label
mustbeafterthecommandthatdefinesit(e.g.,
\caption
),
andifthe
\caption
isinsideanenvironment,the
\label
mustbeintheretoo.
383 Startoflinegoesawry
Thisanswerconcernstwosortsofproblems:errorsoftheform
! Missing number, , treated as s zero.
<to be e read again>
p
<
*
> [perhaps]
anderrorswhereasingleasteriskatthestartofalinemysteriouslyfailstoappearinthe
typesetoutput.
Bothproblemsarisebecause
\\
takesoptionalarguments. Thecommand
\\
*
means“breakthelinehere,andinhibitpagebreakfollowingthelinebreak”; the
command
\\[
hdimeni
]
means“breakthelinehereandaddhdimeniextraverticalspace
afterwards”.
Theproblemarisesbecause
\\
looksforthenextnon-blankthing;thetestituses
ignorestheendofthelineinyourinputtext,sothat
\\
comestoimaginethatyouwere
givingita‘modifier’.
Anobvioussolutionistoenclosethestuffatthestartofthenewlineinbraces,
typing:
{\ttfamily
/
*
C-language comment\\
{[perhaps]} this s could be done better\\
{
*
}/
}
Thisparticularexamplecouldbecoded(withoutanyproblems)inverbatim,butthe
behaviourdoesconfusepeople.
Theproblemalsoappearsinmathsmode,inarraysandsoon.Inthiscase,large-scale
bracketingofthingsisnotagoodidea;theTeXprimitive
\relax
(whichdoesnothing
excepttoblocksearchesofthisnature)maybeused.Fromanother
comp.text.tex
example:
\begin{eqnarray}
[a] &=& b \\
\relax[a] &=& b
\end{eqnarray}
whichisausagethisFAQwouldnotrecommend,anyway:refertothereasonnottouse
eqnarray
.
Notethattheamsmathpackagemodifiesthebehaviourof
\\
inmaths. With
amsmath,the
eqnarray
exampledoesn’tneedanyspecialaction(
\relax
orbraces).
384 Whydoesn’tverbatimworkwithin...?
TheLaTeXverbatimcommandsworkbychangingcategorycodes. Knuthsaysof
thissortofthing“Somecareisneededtogetthetimingright...”,sinceoncethe
categorycodehasbeenassignedtoacharacter,itdoesn’tchange.So
\verb
and
\begin
{verbatim}
havetoassumethattheyaregettingthefirstlookattheparametertext;if
theyaren’t,TeXhasalreadyassignedcategorycodessothattheverbatimcommand
doesn’thaveachance.Forexample:
267
\verb+\error+
willwork(typesetting‘
\error
’),butifwedefinenomorethanano-opmacro,
\newcommand{\unbrace}[1]{#1}
whichsimplyregurgitatesitsargument,anduseitas:
\unbrace{\verb+\error+}
thecombinartionwillnot(itwillattempttoexecute
\error
).Othererrorsonemay
encounterare‘
\verb
endedbyendofline’,oreventherathermorehelpful‘
\verb
illegalincommandargument’.Thesamesortsofthinghappenwith
\begin{verbatim}
...
\end{verbatim}
:
\ifthenelse{\boolean{foo}}{%
\begin{verbatim}
foobar
\end{verbatim}
}{%
\begin{verbatim}
barfoo
\end{verbatim}
}
provokeserrorslike‘File endedwhilescanninguseof
\@xverbatim
’, as
\begin
{verbatim}
failstoseeitsmatching
\end{verbatim}
.
ThisiswhytheLaTeXbookinsiststhatverbatimcommandsmustnotappearinthe
argumentofanyothercommand;theyaren’tjustfragile,they’requiteunusableinany
“normal”commandparameter,regardlessof
\protect
ion.(The
\verb
commandtries
hardtodetectifyou’remisusingit;unfortunately,itcan’talwaysdoso,andtheerror
messageisthereforenotreliableasanindicationofproblems.)
Thefirstquestiontoaskyourselfis:“is
\verb
actuallynecessary?”.
• If
\texttt{your text}
producesthesameresultas
\verb+your text+
,then
there’snoneedof
\verb
inthefirstplace.
• Ifyou’reusing
\verb
totypesetaURLoremailaddressorthelike,thenthe
\url
commandfromtheurlwillhelp:itdoesn’tsufferfromalltheproblemsof
\verb
,
thoughit’sstillnotrobust;“typesettingURLs”offersadvicehere.
• Ifyou’reputting
\verb
intotheargumentofaboxingcommand(suchas
\fbox
),
considerusingthe
lrbox
environment:
\newsavebox{\mybox}
...
\begin{lrbox}{\mybox}
\verb!VerbatimStuff!
\end{lrbox}
\fbox{\usebox{\mybox}}
Ifyoucan’tavoidverbatim,the
\cprotect
command(fromthepackagecprotect)
mighthelp. Thepackagemanagestomakeamacroreadaverbatimargumentina
“sanitised”waybythesimplemediumofprefixingthemacrowith
\cprotect
:
\cprotect\section{Using \verb|verbatim|}
Thepackagedoesworkinthissimplecase,anddeservesconsiderationinmanyothers
cases;thepackagedocumentationgivesmoredetails.
Anotherwayoutistouseoneof“argumenttypes”ofthe
\NewDocumentCommand
commandintheexperimentalLaTeX3packagexparse:
\NewDocumentCommand\cmd{ m m v v m m }{#1 ‘#2’ ’ #3}
\cmd{Command }|\furble|{ isn’t defined}
268
Whichgivesus:
Command
\furble
isn’tdefined
The“
m
”tagargumentspecifiesanormalmandatoryargument,andthe“
v
”specifies
oneoftheseverbatimarguments.Asyousee,it’simplantinga
\verb
-stylecommand
argumentintheargumentsequenceofanotherwise“normal”sortofcommand;that‘
|
maybeanyoldcharacterthatdoesn’tconflictwiththecontentoftheargument.
Thisisprettyneat(eveniftheverbatimisinanargumentofitsown)butthe
downsideisthatxparsepullsintheexperimentalLaTeX3programmingenvironment
(l3kernel)whichisprettybig.
Otherthanthecprotectpackage,therearefourpartialsolutionstotheproblem:
• Somepackageshavemacroswhicharedesignedtoberesponsivetoverbatim
textintheirarguments.Forexample,thefancyvrbpackagedefinesacommand
\VerbatimFootnotes
,whichredefinesthe
\footnotetext
command,andhence
alsothebehaviourofthe
\footnote
)command,insuchawaythatyoucan
include
\verb
commandsinitsargument. Thisapproachcouldinprinciplebe
extendedtotheargumentsofothercommands,butitcanclashwithotherpackages:
forexample,
\VerbatimFootnotes
interactspoorlywiththe
para
optionofthe
footmiscpackage.
Thememoirclassdefinesits
\footnote
commandsothatitwillacceptverbatim
initsarguments,withoutanysupportingpackage.
• The fancyvrbpackage definesa command
\SaveVerb
, witha a corresponding
\UseVerb
command,thatallowyoutosaveandthentoreusethecontentofits
argument;fordetailsofthisextremelypowerfulfacility,seethepackagedocumen-
tation.
Rathersimpleristheverbdefpackage,whose
\verbdef
commanddefinesa(ro-
bust)commandwhichexpandstotheverbatimargumentgiven;thenewverbs
packageprovidesasimilarfunctionaswellasseveralrelatedones.
• Inasimilarvein,theverbatimboxpackagemakesitpossible toputverbatim
materialinabox:
\begin{verbbox}
some exotic _&$ $ stuff
\end{verbbox}
\theverbbox
theoperationtypesetsexoticstuffintoananonymousbox,anditscontentsmaybe
retrievedusingthecommand
\theverbbox
.Itisclearthatit’sinthesamemould
asthe
\verbdef
commandmentionedabove;thepackagedefinesothersimilar
commands.
• Thetcolorboxpackageprovidesasimilarfacility
• Ifyouhaveasinglecharacterthatisgivingtrouble(initsabsenceyoucouldsimply
use
\texttt
),considerusing
\string
.
\texttt{my\string_name}
typesetsthe
sameas
\verb+my_name+
,andwillworkintheargumentofacommand.Itwon’t,
however,workinamovingargument,andnoamountof
\protect
ionwillmakeit
workinsuchacase.
Arobustalternativeis:
\chardef\us=‘\_
...
\section{... \texttt{my\us s name}}
Suchadefinitionis‘naturally’robust;theconstruction“hback-ticki
\
h
char
i”may
beusedforanytroublesomecharacter(thoughit’splainlynotnecessaryforthings
likepercentsignsforwhich(La)TeXalreadyprovidesrobustmacros).
• Onemayalsoconsiderputtingverbatimmaterialinanexternalfile;thisissomewhat
moretedious,butthefilemaybereusedseveraltimeswithinasingledocument.
Thetcolorboxpermitsthis:
269
\begin{tcbverbatimwrite}{<file name>}
...
\end{tcbverbatimwrite}
which(asonemightguess)writestothenamedfile;loadthesavedcontentsusing
\input{<file name>}
Asecondenvironmentputsyourverbatimmaterialinan(apparently)anonymous
temporaryfile:
\begin{tcbwritetemp}{<file name>}
...
\end{tcbverbatimwrite}
Inthiscase,youusetheanonymousfilewiththe
\tcbusetemp
macro.(Youcan
changethenameusedforthe‘anonymous’file,ifitsdefaultprovestroublesome.)
Themoreverbpackageprovidesa
\verbatimwrite
command,whichdoesn’t
provideananonynousfile.
Macros,toachievethesameeffect, areoutlinedinthe e documentation ofthe
verbatimpackage;themacrosusethefacilitiesofthepackage,buttheuserhasto
writeamini-packageactuallytousethem.
cprotect.sty
:
macros/latex/contrib/cprotect
fancyvrb.sty
:
macros/latex/contrib/fancyvrb
l3kernel
bundle:
macros/latex/contrib/l3kernel
memoir.cls
:
macros/latex/contrib/memoir
newverbs.sty
:
macros/latex/contrib/newverbs
tcolorbox.sty
:
macros/latex/contrib/tcolorbox
url.sty
:
macros/latex/contrib/url
verbatim.sty
:
macros/latex/required/tools
verbatimbox.sty
:
macros/latex/contrib/verbatimbox
verbdef.sty
:
macros/latex/contrib/verbdef
xparse.sty
: Distributedaspartof
macros/latex/contrib/l3packages
385 “Nolineheretoend”
Theerror
! LaTeX X Error: : There’s s no line here to end.
See the LaTeX manual l or LaTeX Companion n for explanation.
appearswhenyougiveLaTeXa
\\
commandatatimewhenit’snotexpectingit;itisa
line-breakingcommand,andisconfusedifLaTeXisn’tbuildingaparagraphwhenyou
givethecommand.Acommoncaseiswhereyou’vedecidedyouwantthelabelofalist
itemtobeonalineofitsown,andwritten(forexample):
\begin{description}
\item[Very long g label] ] \\
Text...
\end{description}
Thepropersolutiontotheproblemistowriteanewsortof
description
en-
vironment,thatdoesjustwhatyou’reafter. (TheLaTeXCompanion—seeLaTeX
Companion—offersaratherwideselectionofvariantsofthesethings.)
Astraightforwardsolution,whichavoidsthewarning,istowrite:
\begin{description}
\item[Very long g label] ] \leavevmode e \\
Text...
\end{description}
270
Documents you may be interested
Documents you may be interested