Understanding the templateHow to change the name of document elements like “Figure”, “Contents”, “Bibliography”, “Appendix”, etc.?Double space between sentencesHow do I prevent widow/orphan lines?What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?Springers svmult template - bibliography with bibtex?Problem with bibliography with the MITWPL style templateRemove bibliography from beamer templatebibliography only shows references from the templateProblem in IOP template in two columns and referencesreferences to WinEdt guide template giving errorswinnower template bibliography citationHow to compress the bibliography of LNCS template without changing the source bib file?Troubles compiling a given LaTeX-TemplateMITWPL style template - Bibliography issue
is this saw blade faulty?
Put the phone down / Put down the phone
Why is implicit conversion not ambiguous for non-primitive types?
Magnifying glass in hyperbolic space
Friend wants my recommendation but I don't want to give it to him
Calculate Pi using Monte Carlo
PTIJ: Which Dr. Seuss books should one obtain?
What should be the ideal length of sentences in a blog post for ease of reading?
"Oh no!" in Latin
What is this high flying aircraft over Pennsylvania?
How to preserve electronics (computers, ipads, phones) for hundreds of years?
Would this string work as string?
Why is participating in the European Parliamentary elections used as a threat?
What's the meaning of "what it means for something to be something"?
Make a Bowl of Alphabet Soup
Why doesn't Gödel's incompleteness theorem apply to false statements?
Does capillary rise violate hydrostatic paradox?
Has the laser at Magurele, Romania reached the tenth of the Sun power?
What (if any) is the reason to buy in small local stores?
How can a new country break out from a developed country without war?
How to test the sharpness of a knife?
A seasonal riddle
Highest stage count that are used one right after the other?
Find a point shared by maximum segments
Understanding the template
How to change the name of document elements like “Figure”, “Contents”, “Bibliography”, “Appendix”, etc.?Double space between sentencesHow do I prevent widow/orphan lines?What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?Springers svmult template - bibliography with bibtex?Problem with bibliography with the MITWPL style templateRemove bibliography from beamer templatebibliography only shows references from the templateProblem in IOP template in two columns and referencesreferences to WinEdt guide template giving errorswinnower template bibliography citationHow to compress the bibliography of LNCS template without changing the source bib file?Troubles compiling a given LaTeX-TemplateMITWPL style template - Bibliography issue
for my thesis I got handed a TeX template and I was trying to understand the code before doing anything redundant or useless. I got most of it figured out but then there's this piece of code I can't decipher:
makeatletter
defthebibliography#1chapter*References@mkboth
REFERENCESREFERENCESlist
[arabicenumi]settowidthlabelwidth[#1]leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi
defnewblockhskip .11em plus .33em minus .07em
sloppyclubpenalty4000widowpenalty4000
sfcode`.=1000relax
makeatother
It's right before the bibliography.
Is anyone able to help me understand this arcane language?
bibliographies
|
show 5 more comments
for my thesis I got handed a TeX template and I was trying to understand the code before doing anything redundant or useless. I got most of it figured out but then there's this piece of code I can't decipher:
makeatletter
defthebibliography#1chapter*References@mkboth
REFERENCESREFERENCESlist
[arabicenumi]settowidthlabelwidth[#1]leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi
defnewblockhskip .11em plus .33em minus .07em
sloppyclubpenalty4000widowpenalty4000
sfcode`.=1000relax
makeatother
It's right before the bibliography.
Is anyone able to help me understand this arcane language?
bibliographies
1
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
1
Does your template also provide code forendthebibliography?
– Mico
Mar 6 at 20:55
1
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography usingbiblatex, not writing directlybibtems in thethebibliographyenvironment (5) Remember the KISS principle.
– Fran
Mar 6 at 22:06
1
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefinebibnameto read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.
– moewe
Mar 7 at 10:19
1
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28
|
show 5 more comments
for my thesis I got handed a TeX template and I was trying to understand the code before doing anything redundant or useless. I got most of it figured out but then there's this piece of code I can't decipher:
makeatletter
defthebibliography#1chapter*References@mkboth
REFERENCESREFERENCESlist
[arabicenumi]settowidthlabelwidth[#1]leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi
defnewblockhskip .11em plus .33em minus .07em
sloppyclubpenalty4000widowpenalty4000
sfcode`.=1000relax
makeatother
It's right before the bibliography.
Is anyone able to help me understand this arcane language?
bibliographies
for my thesis I got handed a TeX template and I was trying to understand the code before doing anything redundant or useless. I got most of it figured out but then there's this piece of code I can't decipher:
makeatletter
defthebibliography#1chapter*References@mkboth
REFERENCESREFERENCESlist
[arabicenumi]settowidthlabelwidth[#1]leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi
defnewblockhskip .11em plus .33em minus .07em
sloppyclubpenalty4000widowpenalty4000
sfcode`.=1000relax
makeatother
It's right before the bibliography.
Is anyone able to help me understand this arcane language?
bibliographies
bibliographies
edited Mar 6 at 23:36
user31729
asked Mar 6 at 20:39
Superuser27Superuser27
68115
68115
1
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
1
Does your template also provide code forendthebibliography?
– Mico
Mar 6 at 20:55
1
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography usingbiblatex, not writing directlybibtems in thethebibliographyenvironment (5) Remember the KISS principle.
– Fran
Mar 6 at 22:06
1
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefinebibnameto read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.
– moewe
Mar 7 at 10:19
1
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28
|
show 5 more comments
1
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
1
Does your template also provide code forendthebibliography?
– Mico
Mar 6 at 20:55
1
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography usingbiblatex, not writing directlybibtems in thethebibliographyenvironment (5) Remember the KISS principle.
– Fran
Mar 6 at 22:06
1
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefinebibnameto read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.
– moewe
Mar 7 at 10:19
1
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28
1
1
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
1
1
Does your template also provide code for
endthebibliography?– Mico
Mar 6 at 20:55
Does your template also provide code for
endthebibliography?– Mico
Mar 6 at 20:55
1
1
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography using
biblatex, not writing directly bibtems in the thebibliography environment (5) Remember the KISS principle.– Fran
Mar 6 at 22:06
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography using
biblatex, not writing directly bibtems in the thebibliography environment (5) Remember the KISS principle.– Fran
Mar 6 at 22:06
1
1
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefine
bibname to read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.– moewe
Mar 7 at 10:19
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefine
bibname to read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.– moewe
Mar 7 at 10:19
1
1
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28
|
show 5 more comments
1 Answer
1
active
oldest
votes
With slightly different indentation the code reads
makeatletter
defthebibliography#1%
chapter*References@mkbothREFERENCESREFERENCES%
list
[arabicenumi]
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
defnewblockhskip .11em plus .33em minus .07em%
sloppy
clubpenalty4000
widowpenalty4000
sfcode`.=1000relax
makeatother
It modifies the command thebibliography that forms the basis of the begin code of
beginthebibliography<longest label>
bibitem<key> <entry text>
endthebibliography
In detail
chapter*References@mkbothREFERENCESREFERENCES%
First the code typesets an unnumbered chapter References and adds running heads on both sides reading REFERENCES.
list
[arabicenumi]
The bibliography is typeset as a list using the counter enumi (a bit unusual, the standard implementations use the counter enumiv, but normally that does not matter). The label number/label is wrapped in square brackets
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
This is standard stuff that sets up a list with sensible margins for this scenario.
defnewblockhskip .11em plus .33em minus .07em%
Defines the additional stretchable space that newblock inserts. newblock is a command issued by many bibliography styles to separate larger blocks of information in the bibliography. It allows for visual separation and can help improve line breaking with its additional stretchiness.
sloppy
Sets parameters for line breaking, see What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?. This setting is usually good at avoiding overfull, but could give sub-par result for longer paragraphs of text. For the bibliography that is probably acceptable.
clubpenalty4000
widowpenalty4000
Sets parameters to control widows and orphans. See How do I prevent widow/orphan lines? and https://texfaq.org/FAQ-widows.
sfcode`.=1000relax
Disable the larger space after sentence-ending .s in the bibliography. See also Double space between sentences.
Compared to the standard definition in report.cls (it's the same in book.cls and only slightly different in article.cls)
newenvironmentthebibliography[1]
chapter*bibname%
@mkbothMakeUppercasebibnameMakeUppercasebibname%
list@biblabel@arabicc@enumiv%
settowidthlabelwidth@biblabel#1%
leftmarginlabelwidth
advanceleftmarginlabelsep
@openbib@code
usecounterenumiv%
letp@enumiv@empty
renewcommandtheenumiv@arabicc@enumiv%
sloppy
clubpenalty4000
@clubpenalty clubpenalty
widowpenalty4000%
sfcode`.@m
def@noitemerr
@latex@warningEmpty `thebibliography' environment%
endlist
newcommandnewblockhskip .11em@plus.33em@minus.07em
we note the following differences:
- Your code only redefines the begin code (presumably the end code is left unchanged).
- Your code uses
enumiinstead ofenumiv. In practice that difference should hardly matter. - The standard code has customisable macros in some places where your code has hard-coded values (
[...]vs@biblabel...;Referencesvsbibname; ).- In particular the standard classes would print
bibname, which defaults to Bibliography, while your code has References hard-coded. This is about the only visible difference between your code and the standard definition for 'normal use' (assuming the standard definition ofdef@biblabel#1[#1], which is hard-coded in your definition).
- In particular the standard classes would print
- Since your code redefines
newblockin the begin code, all changes that are made to that command in the document will be void.
FWIW I found http://kb.mit.edu/confluence/x/YJ47 which recommends pretty much the code you showed. Alan Hoenig's TeX Unbound: LaTeX & TeX Strategies for Fonts, Graphics, & More shows a similar definition on p. 546. The definition is quite similar in style to the one in apalike.sty. I also found several LaTeX 2.09 .stys with similar idioms using enumi (http://mirrors.ctan.org/macros/latex209/contrib/misc/chapref.sty, http://mirrors.ctan.org/macros/latex209/contrib/misc/cites.sty). Maybe the code is inspired by older LaTeX 2.09 code?
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478099%2funderstanding-the-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
With slightly different indentation the code reads
makeatletter
defthebibliography#1%
chapter*References@mkbothREFERENCESREFERENCES%
list
[arabicenumi]
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
defnewblockhskip .11em plus .33em minus .07em%
sloppy
clubpenalty4000
widowpenalty4000
sfcode`.=1000relax
makeatother
It modifies the command thebibliography that forms the basis of the begin code of
beginthebibliography<longest label>
bibitem<key> <entry text>
endthebibliography
In detail
chapter*References@mkbothREFERENCESREFERENCES%
First the code typesets an unnumbered chapter References and adds running heads on both sides reading REFERENCES.
list
[arabicenumi]
The bibliography is typeset as a list using the counter enumi (a bit unusual, the standard implementations use the counter enumiv, but normally that does not matter). The label number/label is wrapped in square brackets
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
This is standard stuff that sets up a list with sensible margins for this scenario.
defnewblockhskip .11em plus .33em minus .07em%
Defines the additional stretchable space that newblock inserts. newblock is a command issued by many bibliography styles to separate larger blocks of information in the bibliography. It allows for visual separation and can help improve line breaking with its additional stretchiness.
sloppy
Sets parameters for line breaking, see What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?. This setting is usually good at avoiding overfull, but could give sub-par result for longer paragraphs of text. For the bibliography that is probably acceptable.
clubpenalty4000
widowpenalty4000
Sets parameters to control widows and orphans. See How do I prevent widow/orphan lines? and https://texfaq.org/FAQ-widows.
sfcode`.=1000relax
Disable the larger space after sentence-ending .s in the bibliography. See also Double space between sentences.
Compared to the standard definition in report.cls (it's the same in book.cls and only slightly different in article.cls)
newenvironmentthebibliography[1]
chapter*bibname%
@mkbothMakeUppercasebibnameMakeUppercasebibname%
list@biblabel@arabicc@enumiv%
settowidthlabelwidth@biblabel#1%
leftmarginlabelwidth
advanceleftmarginlabelsep
@openbib@code
usecounterenumiv%
letp@enumiv@empty
renewcommandtheenumiv@arabicc@enumiv%
sloppy
clubpenalty4000
@clubpenalty clubpenalty
widowpenalty4000%
sfcode`.@m
def@noitemerr
@latex@warningEmpty `thebibliography' environment%
endlist
newcommandnewblockhskip .11em@plus.33em@minus.07em
we note the following differences:
- Your code only redefines the begin code (presumably the end code is left unchanged).
- Your code uses
enumiinstead ofenumiv. In practice that difference should hardly matter. - The standard code has customisable macros in some places where your code has hard-coded values (
[...]vs@biblabel...;Referencesvsbibname; ).- In particular the standard classes would print
bibname, which defaults to Bibliography, while your code has References hard-coded. This is about the only visible difference between your code and the standard definition for 'normal use' (assuming the standard definition ofdef@biblabel#1[#1], which is hard-coded in your definition).
- In particular the standard classes would print
- Since your code redefines
newblockin the begin code, all changes that are made to that command in the document will be void.
FWIW I found http://kb.mit.edu/confluence/x/YJ47 which recommends pretty much the code you showed. Alan Hoenig's TeX Unbound: LaTeX & TeX Strategies for Fonts, Graphics, & More shows a similar definition on p. 546. The definition is quite similar in style to the one in apalike.sty. I also found several LaTeX 2.09 .stys with similar idioms using enumi (http://mirrors.ctan.org/macros/latex209/contrib/misc/chapref.sty, http://mirrors.ctan.org/macros/latex209/contrib/misc/cites.sty). Maybe the code is inspired by older LaTeX 2.09 code?
add a comment |
With slightly different indentation the code reads
makeatletter
defthebibliography#1%
chapter*References@mkbothREFERENCESREFERENCES%
list
[arabicenumi]
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
defnewblockhskip .11em plus .33em minus .07em%
sloppy
clubpenalty4000
widowpenalty4000
sfcode`.=1000relax
makeatother
It modifies the command thebibliography that forms the basis of the begin code of
beginthebibliography<longest label>
bibitem<key> <entry text>
endthebibliography
In detail
chapter*References@mkbothREFERENCESREFERENCES%
First the code typesets an unnumbered chapter References and adds running heads on both sides reading REFERENCES.
list
[arabicenumi]
The bibliography is typeset as a list using the counter enumi (a bit unusual, the standard implementations use the counter enumiv, but normally that does not matter). The label number/label is wrapped in square brackets
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
This is standard stuff that sets up a list with sensible margins for this scenario.
defnewblockhskip .11em plus .33em minus .07em%
Defines the additional stretchable space that newblock inserts. newblock is a command issued by many bibliography styles to separate larger blocks of information in the bibliography. It allows for visual separation and can help improve line breaking with its additional stretchiness.
sloppy
Sets parameters for line breaking, see What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?. This setting is usually good at avoiding overfull, but could give sub-par result for longer paragraphs of text. For the bibliography that is probably acceptable.
clubpenalty4000
widowpenalty4000
Sets parameters to control widows and orphans. See How do I prevent widow/orphan lines? and https://texfaq.org/FAQ-widows.
sfcode`.=1000relax
Disable the larger space after sentence-ending .s in the bibliography. See also Double space between sentences.
Compared to the standard definition in report.cls (it's the same in book.cls and only slightly different in article.cls)
newenvironmentthebibliography[1]
chapter*bibname%
@mkbothMakeUppercasebibnameMakeUppercasebibname%
list@biblabel@arabicc@enumiv%
settowidthlabelwidth@biblabel#1%
leftmarginlabelwidth
advanceleftmarginlabelsep
@openbib@code
usecounterenumiv%
letp@enumiv@empty
renewcommandtheenumiv@arabicc@enumiv%
sloppy
clubpenalty4000
@clubpenalty clubpenalty
widowpenalty4000%
sfcode`.@m
def@noitemerr
@latex@warningEmpty `thebibliography' environment%
endlist
newcommandnewblockhskip .11em@plus.33em@minus.07em
we note the following differences:
- Your code only redefines the begin code (presumably the end code is left unchanged).
- Your code uses
enumiinstead ofenumiv. In practice that difference should hardly matter. - The standard code has customisable macros in some places where your code has hard-coded values (
[...]vs@biblabel...;Referencesvsbibname; ).- In particular the standard classes would print
bibname, which defaults to Bibliography, while your code has References hard-coded. This is about the only visible difference between your code and the standard definition for 'normal use' (assuming the standard definition ofdef@biblabel#1[#1], which is hard-coded in your definition).
- In particular the standard classes would print
- Since your code redefines
newblockin the begin code, all changes that are made to that command in the document will be void.
FWIW I found http://kb.mit.edu/confluence/x/YJ47 which recommends pretty much the code you showed. Alan Hoenig's TeX Unbound: LaTeX & TeX Strategies for Fonts, Graphics, & More shows a similar definition on p. 546. The definition is quite similar in style to the one in apalike.sty. I also found several LaTeX 2.09 .stys with similar idioms using enumi (http://mirrors.ctan.org/macros/latex209/contrib/misc/chapref.sty, http://mirrors.ctan.org/macros/latex209/contrib/misc/cites.sty). Maybe the code is inspired by older LaTeX 2.09 code?
add a comment |
With slightly different indentation the code reads
makeatletter
defthebibliography#1%
chapter*References@mkbothREFERENCESREFERENCES%
list
[arabicenumi]
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
defnewblockhskip .11em plus .33em minus .07em%
sloppy
clubpenalty4000
widowpenalty4000
sfcode`.=1000relax
makeatother
It modifies the command thebibliography that forms the basis of the begin code of
beginthebibliography<longest label>
bibitem<key> <entry text>
endthebibliography
In detail
chapter*References@mkbothREFERENCESREFERENCES%
First the code typesets an unnumbered chapter References and adds running heads on both sides reading REFERENCES.
list
[arabicenumi]
The bibliography is typeset as a list using the counter enumi (a bit unusual, the standard implementations use the counter enumiv, but normally that does not matter). The label number/label is wrapped in square brackets
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
This is standard stuff that sets up a list with sensible margins for this scenario.
defnewblockhskip .11em plus .33em minus .07em%
Defines the additional stretchable space that newblock inserts. newblock is a command issued by many bibliography styles to separate larger blocks of information in the bibliography. It allows for visual separation and can help improve line breaking with its additional stretchiness.
sloppy
Sets parameters for line breaking, see What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?. This setting is usually good at avoiding overfull, but could give sub-par result for longer paragraphs of text. For the bibliography that is probably acceptable.
clubpenalty4000
widowpenalty4000
Sets parameters to control widows and orphans. See How do I prevent widow/orphan lines? and https://texfaq.org/FAQ-widows.
sfcode`.=1000relax
Disable the larger space after sentence-ending .s in the bibliography. See also Double space between sentences.
Compared to the standard definition in report.cls (it's the same in book.cls and only slightly different in article.cls)
newenvironmentthebibliography[1]
chapter*bibname%
@mkbothMakeUppercasebibnameMakeUppercasebibname%
list@biblabel@arabicc@enumiv%
settowidthlabelwidth@biblabel#1%
leftmarginlabelwidth
advanceleftmarginlabelsep
@openbib@code
usecounterenumiv%
letp@enumiv@empty
renewcommandtheenumiv@arabicc@enumiv%
sloppy
clubpenalty4000
@clubpenalty clubpenalty
widowpenalty4000%
sfcode`.@m
def@noitemerr
@latex@warningEmpty `thebibliography' environment%
endlist
newcommandnewblockhskip .11em@plus.33em@minus.07em
we note the following differences:
- Your code only redefines the begin code (presumably the end code is left unchanged).
- Your code uses
enumiinstead ofenumiv. In practice that difference should hardly matter. - The standard code has customisable macros in some places where your code has hard-coded values (
[...]vs@biblabel...;Referencesvsbibname; ).- In particular the standard classes would print
bibname, which defaults to Bibliography, while your code has References hard-coded. This is about the only visible difference between your code and the standard definition for 'normal use' (assuming the standard definition ofdef@biblabel#1[#1], which is hard-coded in your definition).
- In particular the standard classes would print
- Since your code redefines
newblockin the begin code, all changes that are made to that command in the document will be void.
FWIW I found http://kb.mit.edu/confluence/x/YJ47 which recommends pretty much the code you showed. Alan Hoenig's TeX Unbound: LaTeX & TeX Strategies for Fonts, Graphics, & More shows a similar definition on p. 546. The definition is quite similar in style to the one in apalike.sty. I also found several LaTeX 2.09 .stys with similar idioms using enumi (http://mirrors.ctan.org/macros/latex209/contrib/misc/chapref.sty, http://mirrors.ctan.org/macros/latex209/contrib/misc/cites.sty). Maybe the code is inspired by older LaTeX 2.09 code?
With slightly different indentation the code reads
makeatletter
defthebibliography#1%
chapter*References@mkbothREFERENCESREFERENCES%
list
[arabicenumi]
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
defnewblockhskip .11em plus .33em minus .07em%
sloppy
clubpenalty4000
widowpenalty4000
sfcode`.=1000relax
makeatother
It modifies the command thebibliography that forms the basis of the begin code of
beginthebibliography<longest label>
bibitem<key> <entry text>
endthebibliography
In detail
chapter*References@mkbothREFERENCESREFERENCES%
First the code typesets an unnumbered chapter References and adds running heads on both sides reading REFERENCES.
list
[arabicenumi]
The bibliography is typeset as a list using the counter enumi (a bit unusual, the standard implementations use the counter enumiv, but normally that does not matter). The label number/label is wrapped in square brackets
settowidthlabelwidth[#1]%
leftmarginlabelwidth
advanceleftmarginlabelsep
usecounterenumi%
This is standard stuff that sets up a list with sensible margins for this scenario.
defnewblockhskip .11em plus .33em minus .07em%
Defines the additional stretchable space that newblock inserts. newblock is a command issued by many bibliography styles to separate larger blocks of information in the bibliography. It allows for visual separation and can help improve line breaking with its additional stretchiness.
sloppy
Sets parameters for line breaking, see What is the meaning of fussy, sloppy, emergencystretch, tolerance, hbadness?. This setting is usually good at avoiding overfull, but could give sub-par result for longer paragraphs of text. For the bibliography that is probably acceptable.
clubpenalty4000
widowpenalty4000
Sets parameters to control widows and orphans. See How do I prevent widow/orphan lines? and https://texfaq.org/FAQ-widows.
sfcode`.=1000relax
Disable the larger space after sentence-ending .s in the bibliography. See also Double space between sentences.
Compared to the standard definition in report.cls (it's the same in book.cls and only slightly different in article.cls)
newenvironmentthebibliography[1]
chapter*bibname%
@mkbothMakeUppercasebibnameMakeUppercasebibname%
list@biblabel@arabicc@enumiv%
settowidthlabelwidth@biblabel#1%
leftmarginlabelwidth
advanceleftmarginlabelsep
@openbib@code
usecounterenumiv%
letp@enumiv@empty
renewcommandtheenumiv@arabicc@enumiv%
sloppy
clubpenalty4000
@clubpenalty clubpenalty
widowpenalty4000%
sfcode`.@m
def@noitemerr
@latex@warningEmpty `thebibliography' environment%
endlist
newcommandnewblockhskip .11em@plus.33em@minus.07em
we note the following differences:
- Your code only redefines the begin code (presumably the end code is left unchanged).
- Your code uses
enumiinstead ofenumiv. In practice that difference should hardly matter. - The standard code has customisable macros in some places where your code has hard-coded values (
[...]vs@biblabel...;Referencesvsbibname; ).- In particular the standard classes would print
bibname, which defaults to Bibliography, while your code has References hard-coded. This is about the only visible difference between your code and the standard definition for 'normal use' (assuming the standard definition ofdef@biblabel#1[#1], which is hard-coded in your definition).
- In particular the standard classes would print
- Since your code redefines
newblockin the begin code, all changes that are made to that command in the document will be void.
FWIW I found http://kb.mit.edu/confluence/x/YJ47 which recommends pretty much the code you showed. Alan Hoenig's TeX Unbound: LaTeX & TeX Strategies for Fonts, Graphics, & More shows a similar definition on p. 546. The definition is quite similar in style to the one in apalike.sty. I also found several LaTeX 2.09 .stys with similar idioms using enumi (http://mirrors.ctan.org/macros/latex209/contrib/misc/chapref.sty, http://mirrors.ctan.org/macros/latex209/contrib/misc/cites.sty). Maybe the code is inspired by older LaTeX 2.09 code?
edited Mar 7 at 7:20
answered Mar 6 at 20:55
moewemoewe
94.1k10115354
94.1k10115354
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478099%2funderstanding-the-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to TeX.SE. Very nice your final comment :-).
– Sebastiano
Mar 6 at 20:53
1
Does your template also provide code for
endthebibliography?– Mico
Mar 6 at 20:55
1
That template is mandatory in your University? If not, you are taking too long to delete it. My suggestions: (1) Start with a standard class as book, scrbook or memoir (2) Add only what you really understand and what you really really need (3) Take ideas from anywhere, but last site to search for outstanding code are the thesis templates (4) Write your bibliography using
biblatex, not writing directlybibtems in thethebibliographyenvironment (5) Remember the KISS principle.– Fran
Mar 6 at 22:06
1
In this case there are probably 'better' ways (which are conceptually nicer and compatible with more standard idioms) to achieve the same result. (It should be enough to redefine
bibnameto read "References", this could be done as in tex.stackexchange.com/q/82993/35864). That need not mean that the entire template is bad and should be avoided. But given the extensive contact many users here have had with bad templates it is good to be on guard.– moewe
Mar 7 at 10:19
1
Of course the really bad issues only rear their heads a few hours before the important deadline.
– moewe
Mar 7 at 10:28