Nethence Documentation Lab Webmail Your IP BBDock  


Those documents are obsolete, please use the Nethence Documentation instead.

HomeUnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigsPrivate

LaTeX tips & tricks
 
Base preamble
If your GUI is LyX you might want to start with this to disable the automatic date,
\date{}
 
Then it's good to enable Babel for spell checking and hyphenation. Csquotes is also recommended for use with Biblatex. The default language is the last one mentioned, here french.
\usepackage[english,ngerman,frenchb]{babel}
\usepackage{csquotes}
 
Change the text for the Bibliography heading according to your taste and language e.g.,
enewcommand efname{Enquête et bibliographie}
 
Biblatex tricks
Enable Biblatex with the traditional style (full citation in body or footnote and some limited loc/op cit capabilities),
\usepackage[style=verbose-trad1,backend=biber,
autolang=hyphen,language=auto,
maxbibnames=99,
citepages=separate,
]{biblatex}
Note. stick with biber if you are using LyX and you've set it up in Tools > Options. change to bibtex8 if you are using TexWorks otherwise you'll end up with an error (as far Miktex 2.9 is concerned).
Note. language=auto to also handle idem entries with babel.
Note. sorting=nyt only works (and is the default) with biber processor, not with bibtex8.
Note. maxbibnames to print all authors, disable short name list in the citation.
Note. citepages=seperate as with verbose-* styles, this allows to show both: total pages and the `esp.' page.
 
Don't forget to load your bibliography, better soon than never,
ddbibresource{test.bib}
 
Since Lyx 2.1 and a local layout script I could work around that trick, but I prefer to keep using it,
\letite= ootcite
 
Put the first name first,
\DeclareNameAlias{sortname}{first-last}
 
Change the delimiter from '. ' to ', ',
enewcommand*{ ewunitpunct}{ddcomma\space}
 
Print Ibidem in italics,
enewcommand*{\mkibid}{\emph}
 
Suppress 'in: ' for journals and co.,
enewbibmacro{in:}{}
 
 
Define a macro \mkbiblege analogous to \mkbibparens to wrap text in < and >,
\makeatletter
ewrobustcmd{\mkbiblege}[1]{%
egingroup
lx@blxinit
lx@setsfcodes
<#1>
\endgroup}
\makeatother
Ref. http://tex.stackexchange.com/questions/151110/how-to-fix-the-url-and-doi-font-say-make-it-smaller
 
Adapt the bibliography strings according to your taste and language,
\DefineBibliographyStrings{french}{
urlseen = {consulté le},
url = {en ligne},
idem = {Idem},
idemsm = {Idem},
idemsf = {Eadem},
idemsn = {Idem},
idempm = {Eidem},
idempf = {Eaedem},
idempn = {Eadem},
idempp = {Eidem},
ibidem = {Ibiddddot},
opcit = {opdddotspace citdddot},
loccit = {locdddotspace citdddot},
}
\DeclareFieldFormat{urldate}{ddcomma\spaceibstring{urlseen}\space#1}
\DeclareFieldFormat{url}{ibstring{url}\space\mkbiblege{\url{#1}}}
 
Remove parenthesis made by footcite in a footnote,
\makeatletter
enewrobustcmd{lx@mkbibfootnote}[2]{%
\iftoggle{blx@footnote}
{lx@warning{Nested notes}%
ddspace{#2}}% this was: ddspace\mkbibparens{#2}}
{\unspace
\ifnumlx@notetype= w@
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
i
{suse{blx@theendnote#1}{\protecting{lxmkbibnote{end}{#2}}}}
{suse{footnote#1}{\protecting{lxmkbibnote{foot}{#2}}}}}}
\makeatother
Ref. http://tex.stackexchange.com/questions/150959/biblatex-hack-how-to-remove-parenthesis-made-by-footcite-in-a-footnote
 
Other tricks
Use a smaller and lighter font size for URLs and DOIs footnotes versus body, add this to the preamble,
\usepackage{xcolor}
\definecolor{gris}{gray}{0.25}
enewcommand{\UrlFont}{\iffootnote{olor{gris}\scriptsize m}{olor{gris}\small m}}
Note. An alternative would be to use some of those or to use the `resize' package,
% enewcommand{\UrlFont}{\iffootnote{\scriptsize m}{\small m}}
%\urlstyle{same}
 
To remove the text on figures, add this to the preamble,
\usepackage[labelformat=empty]{caption}
 
Advanced footnote layout
You can further configure the footnote layout with the footmisc package e.g.,
\usepackage[perpage,para,bottom,multiple]{footmisc}
Note. It is tricky to make it work with babel so here it goes all in all,
\usepackage[english,ngerman,frenchb]{babel}
\usepackage{csquotes}
renchbsetup{FrenchFootnotes=false}
\usepackage[perpage,para,bottom,multiple]{footmisc}
Note. For having raggedright footnotes you might add,
enewcommand{ ootnotelayout}{ aggedright}
Note. And to prevent a footnote to spread on several pages you might want to force it on the same page,
\interfootnotelinepenalty=10000
Note. Finally if you need to enable the hyperref package but want to exclude the footnotes,
%\usepackage[hyperfootnotes=false]{hyperref}
 
In the previous example, english is activated by default although it may not be an english document. It is needed to get the footnote right, and you need to switch to french manually. Start the document with,
(ERT) \selectlanguage{frenchb}
 
An alternative to the to handle multiple footnotes would be,
\let\oldFootnote ootnote
ewcommand extToken elax
enewcommand ootnote[1]{%
\oldFootnote{#1} uturelet extToken\isFootnote}
ewcommand\isFootnote{%
\ifx ootnote extToken extsuperscript{,} i}
 
Refs.
Incompatibility between footmisc-option multiple and hyperref
 
MWE tricks
To show the text body AND the footnote next to each other, push the text to the bottom with,
   ull fill
Refs.
space after fill ignored
Why are URLs typeset with monospace fonts by default?
What is ull and when do we need to use it?: http://tex.stackexchange.com/questions/24919/what-is-null-and-when-do-we-need-to-use-it
 
To check margins and text layout you could also add this in the preamble,
\usepackage{lipsum}
and this in the body,
\lipsum[1]
Note. optional argument '1' here for just one paragraph, otherwise the default occupies more than one page.
 
Bibtex / Natbib tricks
Get rid of the numbering of the 'plain' or 'plainnat' Bibtex styles,
\makeatletter
enewcommand\@biblabel[1]{}
\makeatother
 
bibentry package
To configure Natbib with the bibentry package, configure Natbib as usual and add this preamble to the document,
\usepackage{bibentry}
obibliography*
you should now be able to insert complete references by doing,
(ERT) ibentry{clé}
 
Bibtex / Jurabib tricks
Choose a Jurabib style among: jox, jurabib, juraeco or jurunsrt.
 
Add this preamble e.g.,
\jurabibsetup{
authorformat={allreversed,and,reducedibidem},
%Replaces recurring authors name(s) by a dash
bibformat=ibidem,
%removes bold author name
%biblikecite,
citefull=first,
commabeforerest,
dotafter=bibentry,
ibidem=strictdoublepage,
idem=strictdoublepage,
titleformat={commasep,italic},
super,
}
enewcommand{ibtfont}{ extit}
enewcommand{ibansep}{, }
enewcommand{ibatsep}{, }
enewcommand{ibbdsep}{, }
Note. The 'super' option allows you to use complete references in footnotes with just ite (default button in LyX).
Note. The 'lookat' option which points to another note on a previous page conflicts with some documents types. And I prefer the classical ibid style anyway.
 
Only problem with Jurabib (apart from the fact that it isn't maintained anymore): it doesn't handle internationalized bibliographies.
 
Bibtex / Babelbib tricks
(FR) Copiez 'C:\Program Files\MiKTeX 2.9ibtexstabamspl.bst' sur le bureau puis renommez le en 'babamspl-custom.bst' afin d'en retirer tous les appels à la fonction 'format.language' ainsi que, facultativement, la fonction elle-même. Cela désactive l'indication de la langue de l'ouvrage à la fin de chaque entrée bibliographique (elle est affichée si différente de la langue principale du document).
 
You can also use the Bibtex Babelbib style for internationalized bibliography,
\usepackage[english,ngerman,francais]{babel}
\usepackage[varlanguage]{babelbib}
\setbtxfallbacklanguage{francais}
 
In the bib file,
Language = {french},
or
Language = {english},
Note. in e.g. the title entry, do not place a space before colons (or only in the languages that need one, eventually), those will be added if non-english entry.
 
You will notice that hyphenation and colons are placed adequately depending on the bib entry language parameter.
 
Ref. Multilingual bibliographies: The babelbib package
 
Additional notes
General
The first paragraph's identation depends on the default language, (enabled for french, disabled for english), so it is automatic and you shouldn't use it. If you really want to force that identation when it doesn't happen (e.g. english language),
\usepackage{indentfirst}
 
(FR) Nota. Si vous souhaitez faire apparaître des éléments indépendants dans la table des matières (et non pas si vous souhaitez simplement retirer les numéros aux chapitres, auquel cas je vous invite simplement à suivre la procédure décrite plus haut au sujet de la configuration de la numérotation),
Ctrl-L
  ddcontentsline{toc}{chapter}{\protect umberline{}Introduction générale}
Refs.
http://patatos.over-blog.com/article-comment-faire-apparaitre-les-chapitres-non-numerotes-dans-la-table-des-matieres-avec-lyx-111573508.html
http://tex.stackexchange.com/questions/11668/adding-unnumbered-sections-to-toc
 
Biblatex
For verbose-* styles that do note-style (page) referencing in the footnotes (I do not use those), make sure it is enabled in the biblatex options,
[...,pageref,pagetracker=true,]
 
Global references
Index of /LaTeX/cours
LaTeX
Getting to Grips with LaTeX
\pagebreak vs ewpage: http://tex.stackexchange.com/questions/736/pagebreak-vs-newpage
LaTeX/Paragraph Formatting
 
References about document types
Why should I *not* use the KOMA-Script classes?
 
References about footnotes
LaTeX Footnotes
LaTeX footnotes
LaTeX/Footnotes and Margin Notes
Multiple footnotes at one point
comma delineation of consecutive endnotes
Footnotes/Endnotes
3.2. Footnotes, endnotes, and marginals
footmisc
Change line spacing for footnote text only
 
References about packages
hyphenat – Disable/enable hypenation
 
References about endnotes
EndNotes
Customize endnotes
 

Last update: Jan 20, 2015