Tag Info

Hot answers tagged

65

Preliminaries In this answer, I'll be discussing "objects" such as "Theorem 2", "Lemma 3", "Page 7", and "Section 4". Each object is assumed to be associated with a \label command, e.g., \label{thm:important} and \label{sec:results}. Classes of cross-references: Static, semi-dynamic, and fully dynamic Static or hard-coded cross-references. As the name ...


57

cleveref Many others are documented in section 6 of the hyperref README. Some are more complex than simply loading after hyperref. Here are some more common ones... amsrefs float before hyperref before algorithm chappg sidecap linguex


41

geometry: From the manual: With mag <> 1000, no truedimen and hyperref, hyperref should be loaded before geometry. Otherwise the resulted PDF size will become wrong. robustindex hypdestopt, hypcap, hypbmsec attachfile showframe, showidx (which disables the \hrefs in the index but in this loading order at least documents compile at all) uri, ...


39

You can use the internal LaTeX macro \@ifpackageloaded to test if a package was loaded: \@ifpackageloaded{<name>}{<true>}{<false>} There are also: \@ifpackagewith{<name>}{<option-list>}{<true>}{<false>} \@ifpackagelater{<name>}{<date YYYY/MM/DD>}{<true>}{<false>} For further macro see ...


32

hyperref compatibility The hyperref package redefines many macros of LaTeX and LaTeX packages for generating hyperlinks in documents, for many kinds of references, such as citations, footnotes, captions, table of contents entries, and bookmarks. That's why it should usually be loaded after other packages, with some exceptions, such as some of the following ...


31

Other common ones include bookmark glossaries


29

The degree to which something is 'stable enough' will depend on your requirements. I'll answer by taking this situation in roughly the order of stability as I see it. If you want 'will never change again', then plain TeX is probably your best bet. Knuth does still fix bugs periodically, but most things are now likely to be regarded as 'features' rather than ...


28

Load xcolor before tikz: \usepackage[table]{xcolor} \usepackage{tikz} The problem is that pgf/tikz already loads xcolor so loading it again with a new package option triggers the error message. Another option is to pass the table option to the class and not to the xcolor package. Then the packages can be loaded in any order: ...


26

Load varioref first, then hyperref, then cleveref. See section 12.1 of the cleveref manual. \documentclass[ngerman]{scrartcl} \usepackage{babel} \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} \begin{document} \section{Erster Abschnitt}\label{sec} \begin{figure} \rule{\textwidth}{1cm} \caption{bild}\label{bild} \end{figure} Siehe ...


26

The very recent version of the subcaption package will even issue an error: ! Package caption Error: The `subcaption' package does not work correctly (caption) in compatibility mode. The only way to get around this is to specify the option compatibility=false to the caption package: \documentclass{cifa} \usepackage{subcaption} ...


21

Package functionality The functionality provided by the various packages for cross-referencing may be divided as follows: Formatting references according to the type of label being referred to (i.e., typesetting "section 3" instead of only "3"). Packages like fancyref, prettyref or refstyle provide a semi-automatic solution as you must adhere to certain ...


21

fntguide is my standard go-to reference for these kinds of questions. Here's the entirety of what it has to say about the matter: Warning: If you wish to use T1-encoded fonts other than the 'cmr' family then you may need to load the package (e.g. times) that selects the fonts before loading fontenc (this prevents the system from attempting to load ...


21

Freek Dijkstra has put together a nice wiki of Latex package conflicts. Hyperref is the one he singles out for criticism: it has the nasty property that sometimes it conflicts when it is put earlier, sometimes when it is put later than other widely used packages, encouraging cargo-cult document headers. He's had less trouble with inputenc conflicts that ...


19

I've never used this combination myself, but a search with your favorite engine should show you that there are some incompatibilities, e.g. (all in German): Paket titlesec und KOMA-Skript-Befehl \setindexpreamble (it was originally a usenet post, but the archived Google groups version is broken; with an interesting answer of Markus Kohm, the author of ...


18

egreg answered the specific issue but the general issue of avoiding package loading as mentioned in comments: \documentclass{article} \ProvidesFile{longtable.sty} \usepackage{longtable} \typeout{longtable is: \meaning\longtable} \stop produces longtable is: undefined showing that the package is not loaded, despite the \usepackage.


17

\PassOptionsToPackage{dvipsnames}{xcolor} \documentclass{...} \usepackage[normalem]{ulem} \usepackage[all]{xy} \usepackage{xcolor} However, it looks like that xcolor is already loaded by your documentclass or another package


17

This is actually a timing problem: The metadata has to be inserted before the final \clearpage command, otherwise, it isn't written to the PDF document any more. However, memoir issues a \clearpage with \AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}} so the code used by hyperxmp \AtBeginDocument{% % [...] \AtEndDocument{% ...


17

Basically the package is only loaded once, with the options specified at that point. Any later uses of \RequirePackage or \usepackage are silently ignored if the options specified were specified earlier, or generate an error otherwise. Normally it works to put options on \documentclass, so they are global options seen by all packages. The help text for ...


16

Once you get the error message: ! LaTeX Error: Option clash for package xcolor. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.17 type "h" (without the quotation marks, for help) in the output console and you get ? h The package xcolor has ...


16

EDIT: After discussion in comments, it turns out that I had underestimated the problem, and that David's answer was closer to being the correct answer than mine. Three catcode régimes are involved here. In chronological order, those are: catcodes in force when the code of the tabu package is read (tokenized); catcodes in force when the preamble of the ...


16

As Andrew has mentioned, the general procedure to prevent symbol names clashes when two packages define the same symbol name is to load the first package, rename the conflicting symbols, and then load the second package. The \savesymbol command from the savesym package can be used to this; \savesymbol{XXX} renames a symbol from \XXX to \origXXX: ...


15

It used to be a bad idea to have \usepackage[T1]{fontenc} before any other font packages because it could trigger LaTeX to attempt to load T1 versions of the Computer Modern font; nowadays I believe this isn't a problem because the EC fonts are installed by default (even though you probably don't want to use them with Latin Modern now in existence). ...


15

If the class defines either a macro or an environment called proof, add the instructions \let\proof\relax and \let\endproof\relax before loading amsthm.


15

In usbthesis.cls change the line: \renewcommand{\year}[1]{\newcommand{\@year}{#1}} to, \newcommand{\myyear}[1]{\newcommand{\@year}{#1}} and use \myyear rather than \year in your document. It looks like pgfmathfunctions.random.code.tex uses \year to generate a random seed. Since the class redefines \year before it's use in that file, you're getting ...


15

Marcus Kohm, the author of KOMA-Script (see his initials), utters about this frequently, but unluckily for TeX.SE usually in German. Also I would prefer to say, some packages are not fully compatible instead of they are incompatible, because in most cases they work partially and often there’s a workaround. Every package, that makes a redefinition of ...


15

One can use David's suggestion, but etoolbox must be loaded anyway: \ProvidesFile{xpatch.sty} \usepackage{etoolbox} \usepackage{imakeidx} \usepackage{regexpatch} should do.


14

Tex/Latex have what is called monolithic state: you can't cleanly isolate the configuration done by one package from another, which is one of the reasons why incompatibilities are possible. This means there is no way to identify how to undo what changes the \usepackage command has caused. Think of installing software on your machine: if the software makes ...


14

tabu uses \scantokens while parsing the preamble, which means it picks up the local verbatim setting and goes wrong. Since the argument is just \def\:{|} just read them with the normal catcodes. Also you need a \par or it all comes out on one line. \documentclass{article} \usepackage{verbatim} \usepackage{tabu} \makeatletter ...


14

The solution is to load geometry before fancyhdr and apply the settings, then configure fancyhdr, not the other way round. A working example: \documentclass{book} \usepackage[english]{babel} \usepackage{geometry} \geometry{a4paper} %paper format \geometry{left=27.5mm,right=27.5mm,bottom=27.5mm,top=27.5mm} %margins \usepackage{fancyhdr} ...


14

(Basically what was in my comment, but hopefully a bit clearer here.) The only command that I can find which is defined in both tengwarscript and musixtex is \Tten. In tengwarscript it is defined with \newcommand which checks to see if it has already been defined (and throws an error if so). In \musixtex it is defined via a \let (which doesn't check), ...



Only top voted, non community-wiki answers of a minimum length are eligible