New answers tagged

6

It is not really a bug, but history: The default value of unicode is currently false, but with xelatex hyperref had to force the value to true and so issues a warning when it switches it (which happens when it encounters your pdftitle). The unicode option is unneeded with xelatex (as it is forced anyway), but currently the only way to avoid the warning is ...


1

You load biblatex with refsection=section which essentially creates a new, separate bibliography environment for each \section. If you don't have a \printbibliography for that section, the citations will essentially be left hanging without a suitable bibliography. This can be seen by wrong link targets but may also mean that citations don't appear in the ...


2

By default, hyperref has three global and exclusive types of link styles: pdfborder (by default), colorlinks, and pdfborderstyle, and six link types: cite (bibliographic references), file, link (internal references), menu, run, and url. Here is a crude implementation that allows user to set one of the first two link styles per link type. Update: Patch ...


0

It does not exactly answer your question but you might still be interested in what follows. Indicating explicitly DOI (long or short) is not really useful for the reader. What matters is a clickable link that points to the cited document. The idea is then to have the word "DOI" clickable with the actual DOI as the underlying link. One way to ...


4

It seams that I found a solution myself. Here it is: % Load packages and declare external docs. \usepackage{xr-hyper}% <== load xr-hyper package \usepackage[unicode,colorlinks]{hyperref}% <== load hyperref package \usepackage[user]{zref} \makeatletter %%\zref@newprop{chaptervalue}[-1]{\the\value{chapter}}% <= note the default ...


4

I would simply add another property, e.g. a new counter, that you can advance for the appendix. Then you can test it for equality. The alternative would be an "absolute chapter counter", that would work too, and make the test a bit shorter. \documentclass[oneside]{book} \usepackage{xr-hyper}% <== load xr-hyper package \...


5

Links doesn't link "content". They only add a rectangle annotation box. The content is only relevant to decide how large the box should be. So if you want a smaller link area you need to hide the content that should not contribute to the box. E.g. \documentclass{article} \usepackage{amsmath} \usepackage{amsthm} \usepackage{hyperref} \hypersetup{ ...


2

For local paths: \href{file:C:/foo/bar/baz/.} The trailing period looks like a file extension so hyperref doesn't try to be smart and append ".pdf". For UNC paths you need to double the leading forward-slashes for some reason: \href{file:////server/share/foo/bar/baz/.} There's no need to slash-escape embedded space characters in the path. I haven'...


1

For biblatex you should not (LaTeX-)escape any US-ASCII chars in the url field. That means that % should remain % and should not be escaped as \%. With BibTeX the situation is not as uniform. The original standard BibTeX styles date back to the eighties before URLs were standardised and therefore don't have a dedicated url field. Later BibTeX styles have URL ...


1

your method to get unnumbered subsection is imho wrong: you still get numbers in the table of contents which looks simply odd: \documentclass{article} \usepackage[ bookmarksnumbered, bookmarksdepth=2 ]{hyperref} \usepackage{titlesec} \titleformat{\subsection} {\Large} {} {0pt} {} {} \begin{...


0

An alternative solution is to have a button that skips the extra material. This has the disadvantage that you have to remember to press the “don’t show the extra material” button when you get to that slide, but it has two advantages. Firstly, the extra slide is right there next to the main material rather than hidden off in an appendix, which might make it ...


2

That is a very nasty bug in the style. I believe it was intended to redefine \@namedef and the \global remained there. The (anyway rather questionable) redefinition of \enddocument should be patched. \documentclass{article} \usepackage{hyperref} \usepackage{jucs2e} \usepackage{xpatch} \xpatchcmd{\enddocument}{\def\global}{\gdef}{}{} \begin{document} Hello. ...


1

\documentclass[11pt,letterpaper,twoside]{book} \usepackage{pdfpages} \usepackage[unicode]{hyperref} \begin{document} \AddToShipoutPictureBG*{% \AtPageLowerLeft{% \href{https://www.latex-project.org/news/2020/07/22/latex-dev-2020-10-1b/}{\rule{0pt}{\textheight}\hspace*{\textwidth}}}} \includepdf{example-image-letter.pdf} % TEST \end{document}


1

Conceptually this is not really feasible. LaTeX compiles the source code of your form (i.e., the code you show in the question) into a pdf, and afterwards LaTeX is not involved anymore in anything that happens to the pdf. If the pdf viewer allows you to execute Javascript (many viewers don't allow this, but some do) you can make the form interactive, but ...


1

If you want to link to a specific paragraph/section or the entire law with some text more often, you can define a dedicated command for that. I'm using etoolbox's \ifblank to test if the string is empty, because I generally prefer etoolbox tests over ifthen, but that is just a matter of style. \documentclass[12pt]{article} \usepackage{etoolbox} \usepackage{...


2

You need something expandable, ifthen and xifthen won't work. \documentclass[12pt]{article} \usepackage{hyperref} \begin{document} \ExplSyntaxOn \newcommand{\gesetze}[2] { http\c_colon_str//www.gesetze-im-internet.de/#1/ \tl_if_blank:nF {#2}{__#2.html} } \ExplSyntaxOff \href{\gesetze{bgb}{622}}{This is the 622nd paragraph in the law.} \href{...


2

Here I patch the \contentsline command to locally change the link color used in title part of toc entry (compared to the page number part), per toc type. In the following example, the title part of chapter toc entry is changed to red by \def\toccolor@chapter{red}, and the title part of section and subsection toc entries are changed to black by \def\toccolor@...


2

As was layed out in the comments the problem here is not LaTeX and not the Browser but the pdf viewer. Some PDF viewers on MacOS seem to convert the hash sign in the PDF that is correctly inserted by LaTeX. There is a table in this bug report showing which pdf viewers on MacOS create the problem: The bug seems to be on the side of Apple and was reported on ...


0

An alternative way of capitalizing the section titles that doesn't disrupt hyperref can be used: \ExplSyntaxOn \let\@oldsection\section \RenewDocumentCommand{\section}{ s o m }{ % \text_uppercase will replace \tl_upper_case in later l3token versions \tl_set:Nx\@section_upper{\cs_if_exist:NTF{\text_uppercase:n} {\text_uppercase:n{#3}}{\...


0

Set the author for the pdf metadata with pdfauthor. Then hyperxmp will no longer try to get it from the \author command which authblk redefines in an way quite unsuitable for pdf metadata: \documentclass{article} \title{Title} \author{Author} \usepackage{hyperxmp} \usepackage[pdfauthor={Author}]{hyperref} \usepackage{authblk} \usepackage{pdfcomment} \begin{...


1

I think this may be able to achieve what you want. Before spamming my code, please be advised that following requirements need to be met: The compiler must be LuaLaTeX. Download md5.lua and place it in your source folder. This is for creating valid labels for sections/subsections. Place mycode.lua into source folder. mycode.lua -- for debugging -- https://...


1

You can compile the following document to understand the behavior of hyperref: \documentclass{article} \pdfobjcompresslevel=0 \pdfcompresslevel=0 \usepackage[colorlinks,linkcolor=red,anchorcolor=blue,citecolor=green,CJKbookmarks=True]{hyperref} \pagestyle{plain} \begin{document} \section{Problem} When use URL .pdf: \url{./test/test.pdf} \\ When use href ....


1

\ref ususally just returns the number fo a chapter. Since you seem to want \ref to return the title of an unnumbered chapter, use \nameref instead: \documentclass[12pt,letterpaper,openany,oneside]{book} \usepackage{xcolor} \usepackage[bookmarks,hypertexnames=false,debug,linktocpage=true]{hyperref} \hypersetup{colorlinks,linkcolor={blue!90},citecolor={blue!90}...


5

I checked the PDF with Preflight (Acrobat Pro XI) for compatibility with Acrobat 6. It passed without errors. However, the result is quite different when checking against PDF/A, the PDF standard for long-term archiving, but this might not be important in your case. (The standard was updated several times, the first version didn't allow neither OCGs nor ...


0

With some more research it turned out, that any possible solution to my question above would mean a redefinition of standard commands in xr as well as cleveref. This does not seem to be an elegant approach to the problem. Therefore, I came up with the following solution: I replaced \externaldocument{full} by \externaldocument[ext:]{full} and created my own ...


7

You asked, "How can I store a URL in a macro if the URL has a # and/or a % in it?" The \urldef directive of the url package lets you create precisely such macros. E.g., \urldef{\myURL}\url{https://books.google.com/books?id=4tFFDwAAQBAJ&pg=PT233&dq=history+of+trigonometry&hl=en&newbks=1&newbks_redir=0&sa=X&ved=...


4

hyperref's \hyper@normalise comes in extremely handy here. It can be used to sanitise the argument of a macro and allow it to accept special characters without escaping. (I think I first learned about \hyper@normalise from Michael Ummels' answer to Getting those %#!^& signs in the footnote!) Just use it to define a new macro like \newcommand*{\csdefurl}[...


1

Thanks for clarifying the structure of supplementary.tex and for noting that Supplementary Figure 1, Supplementary Figure 2, etc will occur in section headers, not in "ordinary" cross-referencing call-outs. Since the cross-referencing needs in supplementary.tex are very narrowly defined, I believe it makes sense to set up an extra counter variable ...


2

beamer loads hyperref with option implicit=false. This influences behaviors of many user commands from hyperref. In your case, \phantomsection is now an empty macro (defined by \let\phantomsection\@empty). To add a label to frame, you can use option label={<label name>} of frame environment. \documentclass{beamer} \begin{document} \begin{frame}[label={...


1

I think I found the issue with my setup: Beamer defines \insertsection as \def\insertsection{\expandafter\hyperlink\sectionlink}% and so it takes some expansions in between, before we actually typeset a link! Now I had a look on \sectionlink, which is defined as {\let\\=\relax\xdef\sectionlink{{Navigation\the\c@page}{\noexpand\secname}}}%. Honestly I don't ...


2

In your question you say ...\hyperlink{target}{text} and \hyperref[target]{text}... but it should probably be ...\hyperlink{⟨named destination⟩}{⟨text⟩} and \hyperref[⟨cross-referencing-label⟩]{⟨text⟩}... Don't confuse names of LaTeX's cross-referencing-labels with the names of so called "named destinations"="targets"="anchors"...


2

For Beamer users, notice that hyperref is loaded by default. You do not need to add it. In this sense, the problem is exactly the same as the one in the accepted answer (loading the package twice). In case you want to pass arguments to hyperref, you can add them in the \documentclass command. For instance: \documentclass[hyperref={colorlinks = true,linkcolor ...


12

Links go to destinations. Destinations are objects in the pdf created (in pdflatex, for the other engines they are similar commands) with the primitive \pdfdest command. The destination object contains a coordinate and a page object reference number. In a different part of the pdf there is a reference from the name of the destination to this object. << ...


Top 50 recent answers are included