New answers tagged

1

Possible Workarounds Note: These are not solutions to the question asked directly, however offer alternative methods to achieve the same result. These methods may or may not suit your needs, but at least offer some 'food for thought'. Method 1: XML Page Index If a program is configured to run in language German, then the application will ...


1

You must enable \nameref to be aware of the current title, i.e. use \NR@gettitle{#1} inside of the \question command to store the information of the title into the label information, which is written to the .aux file. This is done by \NR@gettitle (actually by \newlabel) \documentclass{article} \usepackage{tocloft} \newlistof{question}{qcnt}{List of ...


2

I apologise in advance for the half baked answer. I'm not 100% percent on this as I do not know much about the PDF specification. However, Adobe Reader has the ability to jump to 'named destinations' within a file and may be suited to what you are looking for. In your document add \usepackage{hyperref} to your preamble and \hypertarget{destname}{} where ...


0

I managed to solve this problem by putting \usepackage{geometry} \geometry{paper=a4paper, left=35mm, right=35mm, top=0mm, bottom=30mm} at the start of the document. This didn't change the position of the .pdfs since they where the size of a whole page but it automatically made the hyperlinks point to the correct position (start of the .pdf)


1

A simpler variant of Ulrike's solution, based on my answer to How to be able to use the number sign (#) in the URL of an underlined href \documentclass{article} \usepackage{xcolor,soul} \usepackage{etoolbox} \usepackage{hyperref} \hypersetup{colorlinks,urlcolor=blue} \makeatletter \patchcmd{\hyper@link@} {{\Hy@tempb}{#4}} {{\Hy@tempb}{\ul{#4}}} {}{} ...


0

Here is the code to add at the start of your document for reference in darkgreen. \usepackage{xcolor} \usepackage{hyperref} \definecolor{darkgreen}{rgb}{0.06, 0.78, 0.3} \hypersetup{ % reference colors colorlinks=true, linkcolor=darkgreen, pdfborder = {0 0 0}, filecolor=magenta, urlcolor=cyan, } \hypersetup{linkcolor=black}


1

\href has to do quite a lot \catcode-magic to handle all the special chars (like #) in urls, so all commands that take an argument and so fix the \catcodes are difficult to insert. You can try the following. But Imho underlining doesn't look good. It will only work for \href (I hope ...) Normal text will break over lines, urls probably not. \ul from soul ...


2

Here is a \uhref command for selectively underlining the text: \documentclass{article} \usepackage{etoolbox} \usepackage{hyperref} \makeatletter \newif\ifunderlinehref \DeclareRobustCommand{\uhref}{\underlinehreftrue\href} \patchcmd{\hyper@link@} {{\Hy@tempb}{#4}} {{\Hy@tempb}{\ifunderlinehref\underline{#4}\else#4\fi}} {}{} \apptocmd{\hyper@link@} ...


3

Adapting Werner's Lorem ipsum example, another (internal-to-hyperref) possibility is this: \documentclass{article} \usepackage{hyperref} \hypersetup{ allbordercolors=0 0 1, pdfborderstyle={/S/U/W 1} } \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut \href{http://any-URL}{pellentesque augue} est, id ornare nisi fringilla ...


1

You can set a specific style using something like this: \documentclass{article} \usepackage{hyperref,xcolor,soul} \let\oldhref\href \renewcommand{\href}[2]{\oldhref{#1}{\hrefstyle{#2}}} \newcommand{\hrefstyle}[1]{\color{blue}\ul{#1}} \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut \href{http://any-URL}{pellentesque augue} ...


2

Well, one way to fix the problem is to change the position of the \underline so that it is placed within the second argument of the href. The answer, then, becomes: \documentclass{article} \usepackage{hyperref} \begin{document} 1 (without \#, link, underlined) = \underline{\href{http://the-best-URL-in-the-world_without-a-number-sign}{URL without number ...


2

Hyperlinks should work just fine in a PDF/A document, using pdfx --- but please send me any example that you find where this is not the case. However active actions are forbidden in a PDF/X, which standard is intended only for accurate high-quality printing. One of the new features in pdfx (v.1.5.8) is to enforce this in PDF/X documents, by patching ...


4

It appears that the macro code for xetex/dvipdfm(x) only inserts the link in the first choice of a mathchoice (so it works in displaystyle only) You could use \mbox or a similar construct that forces text size so avoids the mathchoice internally or a possibly better fix is here I disabled amstext package \iffirstchoice@ test so the macros can not tell ...


1

There are 2 reasons for using filecontents or filecontents* before the \usepackage[..options..]{pdfx}. pdfx.sty processes the metadata as part of loading the package. Thus you want \jobname.xmpdata to be available on disk when pdfx.sty is being loaded, so its information can be read and interpreted at that time. If the .xmpdata file has not been written at ...


1

With pdfx.sty (v1.5.8) the following order of packages works also, provided you change the \usepackage[..options..]{hyperref} into \hypersetup{..options..}. \documentclass[twoside,a4paper,DIV15,parskip=off,9pt]{scrbook} \usepackage[a-1b]{pdfx} % Fonts and typesetting settings \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} ...


1

The latest version (1.5.8) of the pdfx package has been used to create valid PDF/A documents using XeLaTeX. However there are some difficulties. Firstly, you must use an invocation of: xelatex -shell-escape -output-driver="xdvipdfmx -z 0" <filename> which means that the resulting PDF uses no compression, so can be more than 10x the size that it ...


1

(If this is not a duplicate....) All that is needed in this case is to use the optional argument to \newcounter: \newcounter{contentCounter}[section] Where the [section] indicates that contentCounter should be reset to zero with each use of \section. Note that if you need to modify a counter initially defined without the optional argument (or, ...


2

It seems that exam has poor compatibility with hyperref. You just need to add a definition for \theHchoice, so hyperref will pick up this instead of \thechoice. Using \arabic{question}.\arabic{choice} will ensure a unique tag. \documentclass{exam} \usepackage{hyperref} %% keep hyperref happy \newcommand{\theHchoice}{\arabic{question}.\arabic{choice}} ...


1

Hyperref automatically provides targets at the top of each page by the name page.\thepage. \documentclass{scrbook} \usepackage[twocolumn]{geometry} \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} \newcommand{\topref}[1]% #1 = label {\hyperlink{page.\getpagerefnumber{#1}}{\getrefnumber{#1}}} \begin{document} chapter \topref{chapter:foo} ...


2

Use \p@theorem, the “prefix” to the reference number. \documentclass[a4paper,11 pt]{amsbook} \usepackage[utf8]{inputenc} \usepackage{amssymb,amsmath} \usepackage{hyperref} \newtheorem{theorem}{Theorem}[section] \newtheorem{lema}[theorem]{Lemma} \theoremstyle{definition} \newtheorem{deff}[theorem]{Definition} \makeatletter ...


2

I think this is what you want: \documentclass{article} \usepackage{xparse} \usepackage{hyperref} \DeclareExpandableDocumentCommand{\foo}{smm}{% \texorpdfstring {\IfBooleanTF{#1}{\textsf}{\textit}{#2}--#3} {#2-#3}% } \begin{document} \section{This is \foo{A}{B}} \section{This is \foo*{A}{B}} \end{document}


0

All you needed was \string. \documentclass{article} \usepackage[english]{babel} \usepackage{xr-hyper} \usepackage[destlabel=true]{hyperref} \makeatletter \newcommand{\foo@star}[2]{\textsf{#1}-{#2}} \newcommand{\foo@plain}[2]{\textit{#1}-{#2}} \DeclareRobustCommand{\foo}{\@ifstar\foo@star\foo@plain} \makeatother \newcommand{\mysection}[1]{\section[\string ...


1

The checkbox names, in this case, are given by test1, test2 and test3. \documentclass[11pt, letterpaper]{article} \usepackage{enumitem} \usepackage{hyperref} \begin{document} \begin{Form} \begin{enumerate}[label = {\CheckBox[name=test\theenumi]{}} \arabic*:] \item Some item 1 \begin{enumerate}[label = (\arabic*)] \item Some subitem ...


1

The problem arises because the theorem, corollary, definition, lemma, and proposition environments all share the same counter. The quickest solution I can think of is to (a) add the instruction \usepackage[noabbrev,capitalize]{cleveref} after loading the hyperref package and (b) replace all instances of \autoref with \cref. Aside: I can't help but ...


3

Numbered entities do not need an additional \hypertarget, because hyperref already sets an anchor at the place of \refstepcounter. A \label is enough to catch the anchor. \hyperref[<label>]{<text>} can be used to set arbitrary text pointing to the label. Unnumbered entities are more tricky. Since there is usually no anchor, an anchor can be ...


1

You wrote: However, when I use it along with \begin{step}, \begin{claim}, or \begin{myclaim}, there two additional round parentheses appear. Is there a way to get rid of those round braces? Don't surround the corresponding \hypertarget{...}{} statements with square brackets ([ and ]). Otherwise, amsthm will interpret the material as indicating the ...


2

The problem is that you have two pages numbered 1, even if the first has no visible numbering: before \frontmatter the numbering is the default, that is arabic. You can solve the issue by assigning a different numbering style to the title page: \documentclass[a4paper,12pt,twoside]{book} \usepackage[CJKchecksingle,CJKnumber]{xeCJK} ...


0

Building on @Werner's answer I found the following was necessary in the preamble ... \usepackage[obeyspaces]{url} \PassOptionsToPackage{obeyspaces}{url} % Other packages which might use the url package. \usepackage{hyperref} That is, in practice one needs to use \PassOptionsToPackage just after the package you want to protect, rather than just before ...


2

The start macro \exercise is patched to catch the optional argument. hyperref already sets an anchor for the numbered exercise. The bookmark uses this anchor directly. Package bookmark is added to implement the previous point. Also the bookmarks are updated faster. Full example file: \documentclass[a4paper]{scrartcl} \usepackage[T1]{fontenc} ...


1

You need to make the internal counter of hyperref for thm \theHthm unique. E.g. \documentclass[a4paper, 11pt] {article} \usepackage{hyperref} \newtheorem{thm}{Theorem}[subsection] \newtheorem{prop}[thm]{Proposition} \makeatletter \@addtoreset{thm}{section} \renewcommand\theHthm{\thesection.\thethm} \makeatother \begin{document} \section{One} ...


3

Looks like a hyperref or tikz bug (not fully tracked it down) but you can do this: \documentclass{tikzposter} \usepackage{doi} \def\HyperFirstAtBeginDocument#1{#1} \begin{document} \end{document} The additional line should be the last thing in the preamble, just before \begin{document}


2

The internal \theH<counter> is already explained by Christian Hupfer's answer. The answer also shows, how to fix it in a general way. In this case, there is an alternative way. hyperref refines \@addtoreset, which is used by \counterwithin and \numberwithin to support \theH<counter>. However, if these commands are used before hyperref is loaded, ...


1

This can be accomplished by defining a new version of the autoref command that will have the desired formatting. For example, in the preamble, add: \newcommand\colorAutoref[1]{{\hypersetup{linkcolor=blue}\autoref{#1}}} %% allows for calls to \autoref{} that have a different color from other links. Then, in the document, where you want to add your ...


2

This seems to work, even if the reason is puzzling. ;-) \documentclass{article} \usepackage{titletoc} \usepackage[ colorlinks=true, urlcolor=blue, anchorcolor=blue, citecolor=blue, filecolor=blue, linkcolor=blue, menucolor=blue, linktocpage=true, bookmarks=true, unicode=true, pdfa=true, ]{hyperref} \def\maposectionname{section} ...


4

The standard settings in achemso turn off section numbers by effectively making \section behave like \section*. You therefore need to use \SectionNumbersOn to enable section numbering: this will also generate PDF bookmarks for the sections. If you want numberless sections but also want \SectionNumbersOn then you'll need to use \section* in place of \section, ...


1

Maybe I found a solution, it's enough to define \renewcommand\appendix{\par \setcounter{section}{0}% \setcounter{subsection}{0}% \gdef\thesection{\@Alph\c@section}% \@appendixtrue \titlecontents{section}% [2mm] {} ...


0

If you fiddle with this MWE, you should be able to solve your problem. Of course, you can adapt the icon and what you put in the hyperlink! \documentclass{scrartcl} \usepackage{hyperref} \usepackage{fontawesome} \begin{document} Check-out my profile: \href{https://www.linkedin.com}{\faLinkedinSquare} \end{document} Using fontawesome icons ...


3

According to pp. 17f. of the user guide of the hyperref package, the "starred" forms of the macros that create cross-reference call-outs -- \ref*, \pageref*, \autoref*, and \autopageref* -- are "[f]or instances where you want a reference to use the correct counter, but not to create a link" [emphasis added] Thus, \autoref and \autoref* both create a ...


3

tex4ht doesn't do anything with line breaks in URLs. It works for hyphens because browsers do that, but they don't break words with underscores. We need to insert zero-width space character after underscores to enable the linebreaking. Actions on certain characters may be defined using \g@addto@macro\UrlSpecials command, possibly in the .cfg file: ...


2

As @ChristianHupfer has already pointed out in a comment, the issue you're experiencing is mainly related to the pdf browswer you're employing. If switching pdf browswers is not a viable option, you could try the following remedy: Move the \phantomsection and \label statements to the very start of the \mytab macro. \documentclass[11pt]{report} ...


3

Change your code into \clist_new:N \g_mapo_allauthors_clist \NewDocumentCommand\addauthor{m} { \clist_gput_right:Nn \g_mapo_allauthors_clist { #1 } } \NewDocumentCommand \printall { } { } % initialization \DeclareExpandableDocumentCommand \printall { } { \clist_use:Nnnn \l_mapo_allauthors_clist { ~and~ } { ,~ } { ~and~ } } The main point is ...


1

The \printall must be expanded first, i.e. use pdfauthor=\expandafter{\printall} \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \clist_new:N \l_allauthors_clist \NewDocumentCommand\addauthor{m}{% \clist_put_right:Nn\l_allauthors_clist{#1}% } \NewDocumentCommand \printall{}{ ...


2

Something like this? \documentclass{article} \usepackage{cite} \renewcommand\citeleft{} % no opening or closing brackets \renewcommand\citeright{} \usepackage[colorlinks,citecolor=blue]{hyperref} \begin{document} See \cite{ct1}. \begin{thebibliography}{99} \bibitem[The post]{ct1} bkarpuz, Using hyperref for a citation, StackExchange, 2016. ...


1

beamer has its own methods to set colours. To modify the title colour it is better to use \setbeamercolor{title}{fg=red} instead of messing with the argument of \title{}. \PassOptionsToPackage{unicode=true}{hyperref} \documentclass[xcolor=svgnames]{beamer} \setbeamercolor{title}{fg=red} \title{Example Presentation Created with the Beamer Package} ...


2

Your color in the title triggers the error. Hide it with \texorpdfstring: \title { \texorpdfstring{\color{red}}{}Example Presentation Created with the Beamer Package }


1

Rotating an individual node seems to work, partially; the bounding box of the picture does not work well. (Based on John Kormlyo comment) Rotating inside node seems to work. \documentclass{article} \usepackage{tikz} \usepackage{hyperref} \begin{document} \section{Test section\label{sec:test}} \begin{tikzpicture} \node at (0,5) [draw=blue] ...


2

Until a proper answer comes along, you might consider using this quick and dirty trick: \hyperlink{some label}{\textcolor{normal text.fg}{link text}} If you use it very often, then create a command for it: \newcommand\myhlink[2]{\hyperlink{#1}{\textcolor{normal text.fg}{#2}} MWE \documentclass{beamer} \hypersetup{colorlinks=true} ...


5

This creates 6 hyperlinks along the first edge which link to the second slide. \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{frame}{First} \begin{tikzpicture}\label{picture:first} \node (A) {$A$}; \node (B) [below right=2 and 3 of A] {$B$}; \path (A) edge [line width=5pt] node [pos=0, circle] ...


1

The name={...} option to the definition in the \declaretheoremstyle command defaults to the theorem name, or it's possible to say name={} to remove the prefix in the List of Theorems, but this has an effect to the body-text display as well. (It's not the best solution) The parentheses can be removed by redefining \thmtformatoptarg to be ...


3

Greek letters can also be used in bookmarks: Unicode encoding is needed, because the 8-bit PDFDocEncoding does not contain all letter and symbols. This can be achieved by option unicode or pdfencoding=auto. Option psdextra redefines lots of math symbol commands to work within bookmarks. Example: \documentclass[12pt]{article} \usepackage[ ...



Top 50 recent answers are included