New answers tagged

7

I saw these red, green and blue rectangles in some research papers What is their purpose? Their purpose is to signal to readers that the enclosed fields are not just some sort of cross-reference but the fields are dynamic, in the sense that clicking on them will make the pdf browser jump to the corresponding external or internal link. Does ...


1

Not sure if still needed, but I tried with the following and it seem to inlcude the right parenthesis too: \DeclareCiteCommand{\textcite} {\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \printtext[bibhyperref]{\usebibmacro{textcite}}} {} {\printtext[bibhyperref]{\usebibmacro{textcite:postnote}}% \usebibmacro{cite:post}}...


1

You could wrap the problematic citation like this \hbox{\cite{...}} to make it unbreakable. It worked nicely for me.


3

\UrlFont is for urls, but you have here a "simple" href text, for this only the urlcolor applies. Use either \url or in the \href \nolinkurl: \documentclass[11pt, oneside, a4paper]{article} \usepackage{xcolor} \usepackage[hidelinks]{hyperref} % \hypersetup{colorlinks, citecolor=, linkcolor=, urlcolor=blue} \renewcommand\UrlFont{\color{blue}\...


2

hyperref patches \counterwithin but you use it before hyperref got the change of patching it. So use \counterwithin after loading the hyperref package and the problem should be gone. The answer from Ulrike is just a work-around, trying to correct the damage done by the wrong package load and usage order. IMHO this is the wrong approach. See also https://...


1

Redefine \theHfigure so that it gives an unique identifier for the destination anchor: \documentclass{article} \usepackage{float} \usepackage{graphicx} \counterwithin{figure}{section} \usepackage{hyperref} %\counterwithin{figure}{section} %\usepackage[all]{hypcap} \renewcommand\theHfigure{\thesection.\arabic{figure}} \begin{document} \section{one} \begin{...


0

\counterwithin{figure}{section} \usepackage[all]{hypcap} in the preamble after the hyperref-package. In this case \counterwithin{figure}{section} aswell \usepackage[all]{hypcap} is enough, but sometimes you need both, also \usepackage{caption} often helps. This question uses https://stackoverflow.com/a/6696146/6747994 https://stackoverflow.com/a/4024019/...


2

Somewhere in the depth of the manual is the remark that the option is the name in lowercase. You can either use it in the optional argument or add it to \DefaultOptionsofText. The following works for me. Don't use xltxtra and xunicode, the packages are deprecated. \documentclass[11pt,a4paper]{article} \usepackage{fontspec} \usepackage{polyglossia} \...


1

\documentclass{article}% \usepackage{graphicx} \usepackage{hyperref,catchfile}% for the links \usepackage{verbatim}% for the input %To generate a text file for demonstration \begin{filecontents*}{1.txt} https://www.youtube.com/ \end{filecontents*} \usepackage{hyperref,catchfile} \newcommand\hrefFromFile[1]{% \CatchFileDef\myurl{#1}{\catcode`\#=12\...


4

You can use catchfile to load the url: \begin{filecontents*}{1.txt} https://www.youtube.com/ \end{filecontents*} \documentclass{report} \usepackage{hyperref,catchfile} \CatchFileDef\myurl{1.txt}{} \begin{document} \expandafter\url\expandafter{\myurl} \end{document} If the url contains special chars like % or _ or # you can use the last argument of the ...


1

As per the comments this is an issue with the TeXShop pdf viewer as clicking the link in Acrobat seems to work.


0

I tried the patching method in the link that you provided, but it did not work for me either. Also, I had a similar issue because I wanted to use \pageref, but the solution provided only worked for \getref and not \getfullref also. Fortunately, I was able to get both working by patching two commands: \deftag and \ep@putlabel@b. The first is the one that ...


5

hyperref.cfg has been removed from miktex (at the request of the hyperref maintainer). But your package database is not up-to-date and so miktex is still looking for it. Go to the miktex console (admin and user mode), in the menu tasks you find an entry to update the package database.


1

I'd define a special command for this and use standard functions for resetting the subsubsection counter when \subdivision is issued. \documentclass{article} \usepackage{graphicx} \usepackage[colorlinks=true, linkcolor=blue]{hyperref} \newcounter{subdivision} \counterwithin*{subsubsection}{subdivision} \renewcommand{\thesubsubsection}{\arabic{...


2

The ICML style sets pdfview=FitH in the options to hyperref using the \hypersetup command. For some reason this confuses the Overleaf PDF viewer. Switching the option off makes the link work: % line 94 in icml2020.sty \ifdefined\nohyperref\else\ifdefined\hypersetup \definecolor{mydarkblue}{rgb}{0,0.08,0.45} \hypersetup{ % pdftitle={}, pdfauthor={...


1

You can use option hypertexnames=false for package hyperref: \documentclass{article} \usepackage{graphicx} \usepackage[colorlinks=true, linkcolor=blue ,hypertexnames=false% <- added ]{hyperref} \begin{document} \tableofcontents \subsection*{Subsection A} \addcontentsline{toc}{subsection}{Subsection A} \setcounter{subsubsection}{0} \subsubsection{...


1

All you need is \phantomsection from hyperref. \documentclass{article} \usepackage[pdftex]{graphicx} \usepackage[colorlinks=true, linkcolor=blue]{hyperref} \begin{document} \tableofcontents \phantomsection \subsection*{Subsection A} \addcontentsline{toc}{subsection}{Subsection A} \setcounter{subsubsection}{0} \subsubsection{subsubsection a} ...


0

After some experimentation, I found a solution in creating a new counter. I put it in the last two lines the following block which I use to begin my Supplementary Information. \newcommand{\beginsupplement}{ \setcounter{section}{0} \renewcommand{\thesection}{S\arabic{section}} \setcounter{equation}{0} \renewcommand{\theequation}{S\arabic{...


0

If some one will face this problem in the future and will be using DVI workflow the solution can be dvibreaklinks.sty. It will work only with luatex engine because link insertion is based on \localleftbox and \localrightbox. Links will be properly broken via pages (floats and headings will be ignored) \documentclass{article} \usepackage[paperwidth=10cm,...


2

My comment was wrong, \texorpdfstring is not relevant here (beside helping to avoid a warning). The title is passed for the \nameref through \GetTitleString and so you will have to add the line break to the list of commands to disable. Be aware that this means that the title has to be expanded and that fragile material might break. \documentclass[oneside,...


1

I would avoid such tricks in the booksmarks. How they are handled depends on the implementation of the pdf viewer. On Windows e.g. the adobe reader doesn't like it at all if I try to use a combining accent with a math char in the bookmarks. Beside this I don't think that it is a sane idea anyway: You are putting look over meaning. What should e.g. do a ...


2

The following could work. If you want to use another theoremstyle you will have to adapt it too: \documentclass{memoir} \usepackage{ntheorem} \usepackage{thmtools,xpatch} \makeatletter \xpatchcmd \thmt@restatable{\@xa\protected@edef\csname the#2\endcsname} {\def\thmt@tmp@restatename{#3}\@xa\protected@edef\csname the#2\endcsname}{}{...


2

Do what it says: rerun the document. After pdflatex bibtex pdflatex pdflatex pdflatex your example run without warning and I got Use \usepackage[backref=page]{hyperref} if you want a backref to the page. By default the backref goes to the structure and so here to "document" as you have no section.


11

That is a packaging error in miktex. That happens sometimes. In such cases go to https://github.com/MiKTeX/miktex-packaging/issues and report the issue (if it hasn't been done yet by someone else). I added an issue: https://github.com/MiKTeX/miktex-packaging/issues/159 As a work-around until miktex corrects this: Get hycolor.dtx from ctan https://ctan....


0

The LaTeX sectioning commands all take an optional argument as well as the required one. If the optional argument is used then that will be used for the ToC and any page headings entries and the required argument for the section title in the document; otherwise the required argument is used for all three places. \section[Short ToC entry]{Long main document ...


3

The dvips driver can't break links (this will perhaps change but not directly). If you insist on the latex->ps route you can use the option breaklinks. This is okay for printing, but the linkarea will be wrong: \documentclass[]{scrbook} \usepackage[breaklinks]{hyperref} \usepackage{breakurl} \begin{document} \tableofcontents \chapter{Chapter 1} ...


3

One could argue that the default colours do not need to distinguish between all six kinds of links. Semantically it makes sense to visually highlight the difference between internal links within the document, and external links to other files or web sites. Here is a proposal using the popular 5-class RdBu color scheme from colorbrewer2.org which is both ...


2

I have no idea where the hack is from and what it is supposed to do (and if it is still needed), but to get the word in the margin in red you can try this: \documentclass[11pt]{book} \usepackage{xcolor} \usepackage{makeidx} \usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}] \makeatletter \ifHy@hyperindex \def\HyInd@ParenLeft{(}%Hook in \HyInd@@...


1

You can add the number for each chapter added to the TOC with \addcontentsline by using the \numberline command. For example, the TOC is produced by the following example. \documentclass{book} \usepackage{hyperref} \begin{document} \tableofcontents \chapter*{intro} \addcontentsline{toc}{chapter}{Introduction} \chapter{Title for chap. 1} \section{Some ...


4

Somewhat in accordance with the 'henry ford color scheme' I suggest an even dark gray (60%) across all hyperrefs (with colorlinks as defaults as Szabolcs suggested). Additional bonuses are: No trouble with printing grayscale and no trouble with color vision deficiencies. About the links being colored for safety (i.e. in order to tell where they lead to): ...


2

Well, since I can't comment on this question, I will use the answer part. I faced the same issue after updating MikTeX two days ago. I couldn't compile any document anymore, because like @bbujeya I need Hyperref in those documents. First thing I did was to deinstall MikTeX-Latex, run update package database, run both refreshes and then reinstall MiKTeX-...


3

For voting purposes, I post a second answer in which most link types have the same colour. I chose NavyBlue for this because blue is the typical link colour on the web. Those link types which could be considered a security issue may have another, more alerting colour, such as Red. I will let others decide which link types should be highlighted this way. For ...


7

My personal preference would be that most link should be a uniform NavyBlue (vote here for that option). Furthermore, the default should be colorlinks and not border. Borders are not easy to see and they are misrendered in Preview.app on macOS (see screenshot at end of this post). However, border don't print by default, so some may prefer them to colorlinks....


1

I like Phelypes suggestions. Just wanted to add some that we have used for a few books (that are also available as PDF files). We always use the colorlinks option and does not differentiate between file and url. They are either different colors or darker versions of the default, mainly chosen such that they do not disturb the reading experince. \...


0

I know this is not the answer to the original question, but it might still save someone a couple of minutes: Another reason for links not appearing can be that the document is in draft mode. Double check that this is not the case \documentclass[draft,...]{...}


2

If you modify the test to \pdfcompresslevel=0 \pdfobjcompresslevel=0 \documentclass{article} \usepackage{hyperref} \begin{document} \href{run:relative_path/filename.html#anchor}{test} \href{http:relative_path2/filename.html#anchor2}{test} \end{document} Then you can look at the links hyperref is adding, which are: /Subtype/Link/A<</F(relative_path/...


11

Here's a proposal (the default color column is (unsurprisingly) the default colour, and the example column is the ones I'm suggesting): I tried to stick to darker colours because too bright ones, especially pure (#FFFF00), but also (#00FF00) and (#00FFFF), are terrible to read, both in PDF print. Note that in the picture above the menu colour is ...


Top 50 recent answers are included