When I click on 3.8 in the , I go to the top of the page where 3.8 is, whatever the zoom level I have. But the default hyperref behaviour is to link to the section name. How can I achieve the first one?  I would like also to configure that option only for \sections and not for \sub..., \subsub..., etc.  So in this MWE's ToC A and B should link to the same point.  \documentclass{article} \usepackage{hyperref}  \begin{document} \tableofcontents \clearpage \section{A} A is this. \subsection{A subsec} Text. \section{B} B is this. \end{document}    may be related.
121128
(a) Is is possible to have certain hyperref-hyperlinks (such as those to sections and also (when using memoir) to the table of contents, lists of figures and tables, and bibliography) point to the very left border of the page, not to the interior? Note that I have already tried the hypcap package, which positions figure and table links to the left edge of the text (just where the left margin ends) but not to the left page border. (For reading text, it is good if the text starts not exactly at the edge of one's viewing window but a tad into the window's border.) Also, hypcap doesn't deal with the table of contents, the lists of figures/tables, and the bibliography.  (b) If, in addition, one could make hyperlinks point not only to the left page border but also to the top left corner of the respective page, that would be a useful option. Is that possible?  If people would like starter code for this, here is some I've slightly adapted for :  \documentclass{memoir}   % using the memoir class here is necessary   % for all the desired hyperlinks to be created \usepackage{hyperref} \usepackage[all]{hypcap} % hypcap doesn't help here  \begin{document}  \tableofcontents  \section{A section} This is the only section.  \listoftables \listoffigures  \begin{thebibliography}{9} \end{thebibliography}  \end{document}   Note: I am aware of the hypcap package but not sure whether/how it can be used to address this.
25067
natbib and hyperref create by default two links to the bibentry in the reference section|chapter of the document:   \begin{filecontents}{\jobname.bib} @book{author08, title = {{A Title}}, publisher = {Alpha}, year = {2008}, author = {Author, A}, address = {London} } @book{buthor90, title = {{B Title}}, publisher = {Bravo}, year = {1990}, editor = {Buthor, B}, address = {New York} } \end{filecontents}  \documentclass{article}  \usepackage{natbib} \usepackage{hyperref} \hypersetup{colorlinks,citecolor=red}  \begin{document}  \noindent citet: \citet{author08}, \citet[see][p. 20]{author08} \\ citep: \citep{author08}, \citep[see][p. 20]{author08}  \bibliographystyle{plainnat} \bibliography{\jobname}  \end{document}     In order to avoid two links to the bibliography (one for the [author] and one for the year [year], respectively), I took  to an older question and added it to my preamble.  \usepackage{etoolbox} \makeatletter  \pretocmd{\NAT@citex}{%   \let\NAT@hyper@\NAT@hyper@citex   \def\NAT@postnote{#2}%   \setcounter{NAT@total@cites}{0}%   \setcounter{NAT@count@cites}{0}%   \forcsvlist{\stepcounter{NAT@total@cites}\@gobble}{#3}}{}{} \newcounter{NAT@total@cites} \newcounter{NAT@count@cites} \def\NAT@postnote{}  % include postnote and \citet closing bracket in hyperlink \def\NAT@hyper@citex#1{%   \stepcounter{NAT@count@cites}%   \hyper@natlinkstart{\@citeb\@extra@b@citeb}#1%   \ifnumequal{\value{NAT@count@cites}}{\value{NAT@total@cites}}     {\ifNAT@swa\else\if*\NAT@postnote*\else%      \NAT@cmt\NAT@postnote\global\def\NAT@postnote{}\fi\fi}{}%   \ifNAT@swa\else\if\relax\NAT@date\relax   \else\NAT@@close\global\let\NAT@nm\@empty\fi\fi% avoid compact citations   \hyper@natlinkend} \renewcommand\hyper@natlinkbreak[2]{#1}  % avoid extraneous postnotes, closing brackets \patchcmd{\NAT@citex}   {\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi    \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{}{}{} \patchcmd{\NAT@citex}   {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@close\fi}   {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@space\fi}{}{}  \makeatother     Which gets me almost where I want to be, but leaves me with two issues I would like to be solved:   while \citet includes pre- and postnotes in the link, \citep doesn't. How can \citep be changed to include postnotes? is there a way to color the brackets and commas that are typeset in black in the unmodified first example also in black in the modified second example without removing them from the link?
95757
While writing my thesis I use the hyperref and appendix packages like in the little example below.  test.tex  \documentclass{book} \usepackage{hyperref} \usepackage[titletoc]{appendix}  \begin{document}  \tableofcontents  \chapter{First chapter} \section{Chapter section} \chapter{Second chapter}  \begin{appendices} \input{extra} \end{appendices}  \end{document}   extra.tex  \chapter{First appendix} \section{Appendix section}   This example produces no errors. The end result is a content table with clickable links to all the chapters (including those in the appendices) and formatted the way I want it.  While compiling (pdfLaTeX) the following file is produced:  test.out  \BOOKMARK [0][-]{chapter.1}{First chapter}{}% 1 \BOOKMARK [1][-]{section.1.1}{Chapter section}{chapter.1}% 2 \BOOKMARK [0][-]{chapter.2}{Second chapter}{}% 3 \BOOKMARK [0][-]{Appendix.1.A}{Appendix First appendix}{}% 4 \BOOKMARK [1][-]{section.1.A.1}{Appendix section}{Appendix.1.A}% 5   My thesis is, of course, much larger (more chapters and more appendices). Although the structure is similar, compiling my thesis results in numerous cryptic errors (meaning I don't understand them). I've listed a few below. Commenting the hyperref package allows me to compile, but also disables the links and the bookmarks in the PDF document.  ! Missing \endcsname inserted. &lt;to be read again&gt;                     \penalty  l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}                                                   % 46 The control sequence marked &lt;to be read again&gt; should not appear between \csname and \endcsname.  ! Missing number, treated as zero. &lt;to be read again&gt;                     { l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}                                                   % 46 A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.)  ! Extra \endcsname. \check@bm@number ...0\else \csname B_#1\endcsname                                                    \fi  l.46 ...@skip {}lage.1.D}{B\377lage Afkortingen}{}                                                   % 46 I'm ignoring this, since I wasn't doing a \csname.  ) ! Missing $ inserted. &lt;inserted text&gt;                  $ l.154 \begin{document}   The .out file of my thesis looks fine until you arrive at the appendix bookmarks.  ... \BOOKMARK [1][-]{section.5.4}{Optimalisatie}{chapter.5}% 32 \BOOKMARK [0][-]{chapter.6}{Conclusie}{}% 33 \BOOKMARK [0][-]{chapter*.28}{Bibliografie}{}% 34 \BOOKMARK [0][-]{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}{B\377lage Stopwoordlijsten}{}% 35 \BOOKMARK [1][-]{section.1.A.1}{Nederlandse stopwoorden}{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}% 36 \BOOKMARK [1][-]{section.1.A.2}{Engelse stopwoorden}{B\penalty \@M \hskip \z@skip i\kern -0.02em j\penalty \@M \hskip \z@skip {}lage.1.A}% 37  ...   I believe  is related to my problem, but I can't make head or tails of it (I'm still relatively new to LaTeX). Can anyone help me enable the links and bookmarks in my thesis?  Greetings,  Sander  EDIT  Adding the babel package to the example reproduces the problem.  \usepackage[dutch]{babel}
119982
When I update the fields document-wide (Ctrl + A, then F9) in a Word document that has a table of contents, a dialog appears asking if I want to update page numbers only, or update the entire table. I never want to update page numbers only if the document headings have changed, nor will I ever.  (Apparently this is given as an option in case someone has manually changed an automatically generated ToC, which is almost always a really bad idea.)   Unfortunately, "Update page numbers only" is the default selection in the dialog, which means that I have to select the other option every time. I update the fields all the time when I'm working in a document that has figures and cross-references, so this is an annoying extra step I'd really like to get rid of.   Is there any way to tell Word to stop asking me this stupid unnecessary question?
31468
I am writing a large article type document with a series of complex appendices in it.  I have included a local table of contents with each appendix that lists the sections and subsections within that specific appendix (the local TOC for Appendix A lists only that appendix's subsections, etc) using tools from the etoc package.  What I would like to do is have my appendix sections contain numbered subsections/subsubsections, but have the subsections/subsubsections only appear in the appendix local TOC. However I still want the appendix sections to appear in the main TOC.  Here is a rough approximation of my setup:  \documentclass{article}  \usepackage{tocloft} % Adds tools for TOC customization \usepackage{etoc} % Local toc \usepackage[titletoc,title]{appendix}  \begin{document}    \setcounter{tocdepth}{3}   \tableofcontents    \section{First section}     \subsection{a Subsection}   \section{Second section}     \subsection{a Subsection}     \subsection{Another Subsection}    \begin{appendix}     \section{Appendix A} % &lt;- I want this to appear in the main TOC       \etocsetnexttocdepth{2}       \localtableofcontents       \subsection{Appendix Subsection} % &lt;- I want this to appear in the local TOC, but not the main TOC   \end{appendix}  \end{document}   And the output:
19363
How can I break hyperref URLs in a tabular environment. Consider the following example:   \documentclass{article}  \usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=black,menucolor=black,runcolor=black,urlcolor=black,bookmarks=true]{hyperref} \usepackage{breakurl}  \begin{document}  \url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}  \begin{tabular}{l l}    A long url &amp; \url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}  \end{tabular}   \end{document}   The first one breaks, the second one doesn't. The output looks like:    I am using pdflatex.
117888
This is basically an expanded version of part of  .  The original questioner there wants to redefine \href so that all the links end up in foonotes (rather than in the main document) so my suggestion was the old \let\oldcmd=\cmd \def\cmd{reimplement \cmd in some fancy way} trick.  Turned out that that didn't solve the problem.  But what broke this solution isn't really about the solution, it's about those @&amp;*@%y$#@ characters in URLs and ... *sigh* ... footnotes.  Not being an expert on hyperref, I appeal to the community to help.  (And half an hour gazing at the documentation and source of hyperref has not brought enlightenment either.)  I've tried the solutions at  and  to no avail (though perhaps I'm doing them wrong ... sorry, incorrectly).  Also, note that  is the wrong way around for this: the questioner wants the clickable link in the footnote.  Here's the URL that the questioner presented me with, embedded in a MWE:  \documentclass{article} \usepackage{hyperref}  \begin{document} Hello\footnote{\href{http://www.google.com/#sclient=psy&amp;hl=en&amp;site=&amp;source=hp&amp;q=numbers&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;pbx=1&amp;fp=d5033c56880e0199}{b}} world.  \end{document}   This produces the error:  ! Illegal parameter number in definition of \Hy@tempa. &lt;to be read again&gt;                     s l.9 ...qi=&amp;aql=&amp;oq=&amp;pbx=1&amp;fp=d5033c56880e0199}{b}}                                                    world.   which makes me think that it is the # that is causing the problem.
36040
Is there a package that automatically inserts the ToC level of the reference I inserted?  Section 1.1 \label{a} Subsection 1.1.1 \label{b} Subsection 1.1.2  \label{c}   So that the text:  Blah \superref{a} and \superref{b} and \superref{c}   becomes:  Blah Section 1.1 and Subsection 1.1.1 and Subsection 1.1.2   So that it automatically adapts if I change the level of a label?
100894
I have an article class document with a structure like this.  Part A  Section 1 Section 2   Part B  Section 1 Section 2    I want to reference Section 1 in part A from Section 2 in part B. When I reference a section in another part using \ref, \vref or \cref I get  As seen in Section 1.  Since that appears in Part B, the reader would assume I'm talking about section 1 in part B, but I mean section 1 in part A. Desired output:  As seen in Section 1 in Part A.  Now comes the tricky part. Most of my references are for within the same section. If I'm in Part B and I'm referencing something in Part B, I just want to say  As seen in Section 1  Not  As seen in Section 1 in Part B  Is there some combination of varioref,hyperref, cleveref and whatever else which can do that with a single command? (Bonus points if it is hyperlinked and can include smart page numbers like \vref) I suppose redefining section numbers to be of the form A.1 would work. Is there a way of doing it without that? MWE \documentclass[a4paper]{article}  \usepackage[english]{babel} %do I need this? Gummi throws an error if I leave it out. I dunno. \usepackage{varioref} \usepackage[hidelinks]{hyperref} \usepackage[nameinlink, capitalise, noabbrev]{cleveref}   \begin{document}  \part{First Part}\label{sec:first part}  \section{section in first part}\label{sec:in first part}  \part{Second Part}\label{sec:second part}  \section{section in second part}\label{sec:in second part}  \Cref{sec:in first part} is cool %desired output: Section 1 in Part A is cool.   \Cref{sec:in second part} is also cool. %desired output: Section 1 is also cool.  \end{document}  Edit: The penultimate line is supposed to say 'this part' not 'another part'. Disambiguated the reference sentences.
7407
Could the magic links be updated so that we can link to help center subsections? In the past, [faq#section] used to work, now neither [help#section] nor [help/section] work.  Could this be added?    As per Nick's request, I'm starting a list of shortcuts that would be nice to have; besides the [help#anchor] → /help/anchor ones. Feel free to edit more in:   #benice →  (preferably a section link to the "be nice" section) #bounty →  #promotion →   (preferably a section link)
10557
I wanna display A as Appendix A in TOC, as shown below.     I tried to add \backmatter before \appendix as shown in , but cref{label} will display as Section 1. I also used \renewcommand as suggested in the most posts on this site, but it doesn't make any changes. Here is the source code.  \documentclass[twoside,12pt]{article}  \usepackage{cleveref}  \usepackage[english]{babel} \usepackage[toc, title]{appendix} \renewcommand\appendixname{Anexo} %\renewcommand\appendixpagename{Anexos} \renewcommand\appendixtocname{Appendix}  \begin{document}  \tableofcontents  \section{The main body of the text} Refer to \cref{appendix} for more information.  \appendix \section{A complete table.} \label{appendix} Some text.  \end{document}
5136
I'm aware of the cleveref package \cref which adds the correct reference name (see:  ). I have a few references which refer to the very next section and some find it odd to give the number in this case rather than just say "in the next section". Sometimes I've moved sections around and these references suddenly become quite broken. To have the best of both worlds, is there a way to automate this change?  E.g.: replace "this is discussed further in section 1.4" with "this is discussed further in the next section"
100709
I am using the following code.  \newpage \section*{Abstract} \addcontentsline{toc}{section}{Abstract}  \newpage \tableofcontents \addcontentsline{toc}{section}{Table of Contents}  \newpage \listoftables \addcontentsline{toc}{section}{List of Tables}  \newpage \listoffigures \addcontentsline{toc}{section}{List of Figures}    In my actual document, I have many sections, so the table of contents is actually two pages long.  Unfortunately, when I run my LaTeX file, the 'Table of Contents' section in the Table of Contents has the incorrect page number (while everything else seems to be in order).  It looks like the Table of Contents is using the page number of the second page, instead of the first page.    e.g.  In the Table of Contents, 'Table of Contents' is listed as being under page iii, when actually it starts on page ii.  Page iii is actually the second page of my Table of Contents.  Anybody know a quick fix for this?
89949
When using memoir and hyperref I can't make chapters lowercase in the TOC or I get all sorts of errors.  Here's a MWE:  \documentclass{memoir} \usepackage{lmodern}  % \renewcommand{\cftchapterfont}{\scshape}              % WORKS \renewcommand{\cftchapterfont}{\scshape\MakeLowercase}  % DOESN'T WORK  \usepackage{hyperref} % Without hyperref it's all good  \begin{document}   \tableofcontents*   \chapter{One}   \clearpage   \chapter{Two} \end{document}   Any ideas what's going on and how to fix it?
122992
I need to refer to a model described elsewhere, from a section title, like  \section{Analysis of model X}    One way of referring to a model is to create a new counter, and then write  \section{Analysis of \cref{grandmodelofeverything}}   But now hyperref will complain because of invalid token, and it does not look good in the TOC either, especially since the titles of the sections the describe the models are more descriptive than  \section{Model 1}   They are currently like  \section{Adding the effect from Y processes}   Do I need to invent semi-descriptive long names like "The model by Authors with this modification" or can I live with these quirks?
7435
The hyperref documentation says: "Make sure it comes last of your loaded packages". The reason is that it redefines many LaTeX commands. It's a rule of thumb that helps to avoid errors.  However, there are exceptions, for instance the amsrefs user's guide notes that amsrefs has to be loaded after hyperref.  To avoid problems when adding hypertext functionality: do you know further such exceptions?
98093
This question led to a new package:      I'm using hyperref to have footnote marks link to the footnote proper and I'd like to have some sort of "backreferences" from the footnote proper back to where they're called (à la Wikipedia). For example:  This[1] is the text[2] that serves[3] as an example[1] to the footnote[2] backrefence thing[4]. ------- [1] The first footnote. [a, d] [2] The second footnote. [b, e] [3] The third footnote. [c] [4] The fourth footnote. [f]   Where a, b, c, d, e and f are links to the first, second, third, fourth, fifth and sixth places where footnotemarks are respectively.  I hope I managed to communicate what I'd like, I'm not that good at it :P  A MWE follows.  \documentclass{book} \usepackage{hyperref} \begin{document}   This\footnote{The first footnote. [a, d]} is the text\footnote{The second footnote. [b, e]}   that serves\footnote{The third footnote. [c]} as an example\footnotemark[1] to   the footnote\footnotemark[2] backrefence thing\footnote{The fourth footnote. [f]}. \end{document}