Tag Info

New answers tagged

9

You can use package catchfile to store the contents of a file in a macro: \documentclass[letterpaper,12pt]{article} \usepackage[pdftex,colorlinks=true,hidelinks]{hyperref} \usepackage{catchfile} \usepackage{trimspaces} \CatchFileDef{\GitHash}{contains_git_hash.txt}{} \makeatletter \trim@spaces@in\GitHash \makeatother \hypersetup{ pdftitle={A method ...


3

Package backref (loaded by hyperref) uses \backrefxxx to format one location entry. There are three arguments, the first is the page number, the second the section number and the third the anchor. Then the macro can be redefined the following way: \renewcommand\backrefxxx[3]{% \hyperlink{page.#1}{$\uparrow$#1}% } page.#1 is the page anchor link name, ...


0

A partial answer to my own question: I use cleveref and I only just noticed the part of the documentation that says to use the starred variants \cref*{}when combining with `hyperref if you don't want the references to generate links. I doubt this would have helped solve my MWE though, as I am sure the table of contents works differently, but I thought it ...


0

PDF viewer dependent solution I have been using accsupp for this purpose. The presented solution works in Adobe Reader, Document Viewer (Evince), Okular and Xpdf, but it doesn't work in FoxIt Reader and PDF.js. \documentclass[a4paper]{article} \pagestyle{empty} %\usepackage{luatextra} \usepackage{accsupp} \usepackage[colorlinks]{hyperref} ...


6

Good timing! — I just made a similar “graph of contents” for my own document. :o) How this works: I assign labels to all sections, and use those as the names of the graph nodes. The nodes are then typeset using the command \myref, which outputs three hyperlinks to the given label as part of the node text. (The entire rectangle isn’t clickable, but it’s good ...


4

The LaTeX kernel provides a nifty mechanism for "prefixing" material to cross-references to counters. For every counter variable defined somewhere via a \newcounter macro named, say, somecounter, LaTeX automatically creates an auxilliary macro named \p@somecounter, and the value of this macro is automatically prefixed to the result of a \ref command that ...


0

You can also use \url{} and escape the percentage symbols with a backslash. Maybe not as clean as the other answer but I couldn't make it work as explained so I used this approach and it worked. As an example, for the url http://es.wikipedia.org/wiki/Problema_de_satisfacci%C3%B3n_de_restricciones, the code would be this: ...


0

I prefer the autoref function provided in the hyperref package. Taking examples for tables and figures: The Table reference is \autoref{tab:VHTRC}. The equation reference is \autoref{eq:3}. Next, new reference styles should be renewed at the preamble. Usually I define them just after including the hyperref package. \usepackage{hyperref} ...


4

You could renew the reference command, perhaps something like: \let\oldref\ref \renewcommand{\ref}[1]{(\oldref{#1})} Here's a complete MWE to play with: % arara: pdflatex % arara: pdflatex \documentclass{article} \let\oldref\ref \renewcommand{\ref}[1]{(\oldref{#1})} \begin{document} \section{Section heading}\label{sec:testlabel} Reference: ...


3

The documentation of thmtools tells you that amsthm (or ntheorem) should be loaded before thmtools, so that the package can adjust its macros. So the correct call is \usepackage{amsmath,thmtools} The presence of hyperref is irrelevant. However, the error changes because at loading time, hyperref sees that both thmtools and amsthm are loaded, so it does ...


2

Even if Texmaker doesn't pick up the labels from other \included files, using the label will still work, so \ref{fig:2.1 Random forest} should give the correct figure number, regardless of what subfile you're in. (By the way, xr is not what you want. That is for adding references to completely separate documents, you are adding a reference within the same ...


1

The empty top-level bookmarks entry is caused by \part{}. The bookmark for this "fake" entry can be disabled by: \hypersetup{bookmarkstype=none} \part{} \hypersetup{bookmarkstype=toc} The German part is easy, the traditional table of contents is covered by \usepackage[ngerman]{babel} And the language option can be given to minitoc for its names: ...


2

You are being unlucky. Because of the implementation of \newtheorem in the kernel, under some circumstances the whatsit generated by hyperref is issued in a place where it makes it impossible to remove the space at the end of the paragraph (generated by the end-of-line after Torsione.). Here's a set of examples. \documentclass[a4paper]{report} ...


6

Anchor for the index title that uses \twocolumn In the meanwhile the trouble (order of \phantomsection and \addcontentsline) with MWE is fixed and we can look at the real problem: \cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{\indexname} suffers from a side effect of the optional argument of \twocolumn. The title in the optional ...


2

Workaround I am experiencing the same problem as the OP after zooming in a page and clicking the hyperlinks. I am using the \chapter* command to get a wanted effect (raising an anchor). % run: *latex mal-indextext.tex % plus makeindex, plus another LaTeX run \documentclass{book} \usepackage{hyperref} \usepackage{makeidx} \makeindex \begin{document} ...


4

As suspected by egreg the problem is caused by \@firstupper. If hyperref is loaded, the first token is \AC@hyperlink, but it should be applied to the string in the second argument of \AC@hyperlink. The following example patches \@Iac that contains the call of \@firstupper to propagate \@firstupper to the second argument of \AC@hyperlink if it is present. ...


2

I'm not sure it's a good thing to have the \label automatically prepared. Anyway, cleveref makes the thing you ask very simple. \documentclass{memoir} \usepackage{hyperref} \usepackage{cleveref} \newcounter{requirements} \setcounter{requirements}{0} \crefname{requirements}{Req.}{Req.} \newcommand{\Requirement}[1]{% \par\addvspace{\topsep}% <----- ...


2

I added the macro \Rqref{1} to provide Req. 1 (it is longer to type, but the OP asked for it, and it allows the OP to change the definition in one place to make all occurrences say "Requirement 1" instead of "Req. 1", for example). I also provide the macro \Rqtext{2} to provide the actual text of the requirement. \documentclass{memoir} ...


3

We usually redefine \the_counter_, please see an example. % run: *latex mal-req.tex \documentclass{memoir} \usepackage[colorlinks]{hyperref} \usepackage{lipsum} \newcounter{requirements} \setcounter{requirements}{0} \newcommand{\Requirement}[1]{% ~\linebreak\noindent% {\hspace*{1em}{% \refstepcounter{requirements}% ...


4

You need that LaTeX sees a “stringified” #; here's a way \documentclass{article} \usepackage{hyperref} \begingroup\lccode`?=`# \lowercase{\endgroup \newcommand{\myhref}[2]{\href{fileA.pdf?#1}{#2}} } \begin{document} \myhref{fileAhypertarget}{Let's go} \end{document} Of course you lose the special treatment \href does to special characters, but it's ...


0

If I understand your setup correctly, you have two separate standalone documents, say, doca.tex and docb.tex, and you'd like to cross-reference an item (e.g., a chapter) from Document A in Document B. One way to achieve this objective is to use the xr-hyper package, which is part of the hyperref bundle. The xr-hyper pacakge works exactly the xr package. ...


1

You could try the following. We will presume we have two .bib files: \jobname-1.bib and \jobname-2.bib, here created via filecontents* \begin{filecontents*}{\jobname-1.bib} @inproceedings{slam2001, author = {Thomas Ball and Sriram K. Rajamani}, title = {Automatically Validating Temporal Safety Properties of Interfaces}, booktitle = ...


6

hyperref introduces \theH<counter>. If it exists it is used for the destination name instead of \the<counter>. If the values of \the<counter> are not unique, define \theH<counter> with unique values using your other variables, e.g.: \renewcommand*{\theH<counter>}{<other variable>.\the<counter>} Pseudo code, the ...


4

\thecount needs to be expanded for \@currentlabelnmae. Otherwise the reference contains \thecount and the current number is print in the references. \edef\@currentlabelname{awesome: \thecount} or \protected@edef\@currentlabelname{awesome: \thecount} LaTeX's protection mechanisms (such as \protect) will work, if \protected@edef is used.


3

You have to set \@currentlabelname if you wish nameref to extract the appropriate content. Since you specify the question title using \questtitle, you could incorporate this addition using: \makeatletter \newcommand{\questtitle}[1]{% \renewcommand{\givenquesttitle}{#1}% \protected@edef\@currentlabelname{Quest~\givenquestid: #1}} \makeatother


4

I am enclosing my patch. I am partly executing the draft option as defined in the hyperref.sty file from the hyperref bundle with two key lines commented out. %! *latex mal-hyperlinks.tex \documentclass{article} \pagestyle{empty} \usepackage[colorlinks]{hyperref} % Patch: draft option do all this: \makeatletter \let\hyper@@anchor\@gobble ...


2

The text in the bookmarks is not typeset: font changes are not possible and math formatting is impossible. So the best you can get is an approximate representation of the title. In this case I suggest \section{\texorpdfstring{$V^{\ast}$}{V*}} Minimal example with picture: \documentclass{article} \usepackage{hyperref} \begin{document} ...


2

With option unicode/pdfencoding=auto and psdextra, many math operators including \ast are available in bookmarks. (Option unicode is not related to the input encoding, but to the encoding of the bookmarks. Option pdfencoding=auto uses Unicode if needed, otherwise the 8-bit PdfDocEncoding is used.) \documentclass{article} ...


8

You can change the default format using \crefdefaultlabelformat; in your case, you can use \crefdefaultlabelformat{(#2#1#3)} A complete example: \documentclass{article} \usepackage{cleveref} \crefdefaultlabelformat{(#2#1#3)} \begin{document} \begin{table} \centering A \caption{a test table} \label{tab:test} \end{table} \begin{figure} \centering B ...


1

The linking via page numbers will not work properly, if hypertexnames is disabled. Therefore it should not set to false. The following example works for me: \documentclass{article} \usepackage[ pagebackref, hypertexnames, % default is true since a long time colorlinks, ]{hyperref} \renewcommand*{\backref}[1]{% \ifx\relax#1\empty \else (page ...


3

If we want sorting in index according to the Swedish sorting rules we usually pass -C utf8 -L swedish to xindy. The key problem I found is that we are not able to pass multiple nested parentheses on the input side, the output side, e.g. markup-locref, is having no difficulties. So the mentioned strategy is fine, to turn off generating of the second ...


1

Just use \clearpage rather than \cleardoublepage: \documentclass[twoside]{report} \usepackage{hyperref} \begin{document} \tableofcontents \clearpage \phantomsection \chapter*{Left side} \addcontentsline{toc}{chapter}{Left Side} \clearpage \phantomsection \chapter*{Introduction} \addcontentsline{toc}{chapter}{Introduction} \end{document}


0

I am not sure if I should add this here, or as a comment to my question. I found a temporary solution for the problem. However, it is not a "technical" solution, as it does not explain why the problem exists in the first place. In order to get rid of the bookmark (which is not really there) I printed my pdf using "Adobe pdf". The new generated pdf file is ...


2

I also wanted to delete the annoying "xdvipdfmx (0.x.x)" and here is a solution for windows users (only TeX Live!): Be careful you have to patch the executable, do it on your own risk and make an backup of the file first. Get a Hex-Editor (I'm using the freeware CFF Explorer). Assuming your using it too, open the file xdvipdfmx.exe, go to "Hex Editor" and ...


10

Here is some hair pin curve. \path let \p1=(A.east), \p2=(B.west) , \n1={veclen(\x2-\x1,\y2-\y1)} in node[outer sep=0pt,inner xsep=0pt,align=left,anchor=west,minimum width=\n1,minimum height=1ex] at (A.east) (link) {\hyperlink{gotext}{\hphantom{\hspace*{\n1}}}}; Full code: ...


2

This effect isn't specific to glossaries but occurs more generally: \documentclass[a4paper]{report} \usepackage{fancyhdr} \usepackage{hyperref} \begin{document} \pagestyle{fancy} \chapter{Chapter} \section{Section} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent viverra eleifend mi, eget adipiscing velit. Aenean mauris diam, viverra ...


6

You can redefine \hypertarget so that it defines a new command corresponding to its first argument: \let\oldhypertarget\hypertarget \renewcommand{\hypertarget}[2]{% \oldhypertarget{#1}{#2}% \protected@write\@mainaux{}{% \string\expandafter\string\gdef \string\csname\string\detokenize{#1}\string\endcsname{#2}% }% } In this ...


1

Another alternative is to use the \cite* command which is provided by all by all author-year and author-title styles. See the manual, section 3.7.2 "Style-specific Commands".


4

The error appears when using scrreprt, because it defines % scrreprt.cls, line 2874: \newcommand\section{% \@startsection{section}{\sectionnumdepth}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax \setlength{\parfillskip}{\z@ plus 1fil}\fi ...



Top 50 recent answers are included