• Re: Link in LaTeX

    From Eberhard W Lisse@21:1/5 to All on Mon Mar 25 17:56:06 2024
    RTFM (hyperref)

    mfg, el

    On 2024-03-25 17:49, db wrote:
    [...]
    adding> the package hyperref, and that hides the link text, and puts
    a red frame around each line in the Contents section for some
    reason.
    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicola Talbot@21:1/5 to All on Mon Mar 25 17:39:47 2024
    On 25/03/2024 15:49, db wrote:
    I want to present a link to a pdf file in a pdf.
    In the LaTeX body I have
    http://www.dieterbritz.dk/bla.pdf
    but I want this to be a link. I tried href, adding
    the package hyperref, and that hides the link text,
    and puts a red frame around each line in the
    Contents section for some reason.

    A red frame is the default behaviour and each line in the table of
    contents is a hyperlink when hyperref is loaded.


    I also tried framing the link text with \ url{...}
    but that didn't work.

    So, how do I display the link text and make it a
    link that can be clicked on to get to the pdf?


    Try

    \documentclass{article}
    \usepackage{hyperref}
    \hypersetup{colorlinks}% colour the link text
    % or
    \hypersetup{hidelinks}% links the same colour as surrounding text

    \begin{document}
    \tableofcontents
    \section{Sample}
    \href{http://www.dieterbritz.dk/bla.pdf}{Link to PDF}
    \end{document}

    Regards
    Nicola Talbot
    --
    Dickimaw Books
    Home: https://www.dickimaw-books.com/
    Creating a LaTeX Minimal Example: https://www.dickimaw-books.com/latex/minexample/
    LaTeX Resources: https://www.dickimaw-books.com/latexresources.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicola Talbot@21:1/5 to All on Tue Mar 26 09:10:31 2024
    On 26/03/2024 08:43, db wrote:> Great, thanks. Now, how to make the text
    "Link to PDF"
    look like a link, e.g. colour it blue?

    The colorlinks setting has different colours for different types of
    links. The colour for external links is governed by urlcolor:

    \hypersetup{colorlinks,urlcolor=blue}

    The complete set of link colour options are listed in the section
    "Extension options" in the hyperref manual (`texdoc hyperref` or http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.pdf).

    Regards
    Nicola Talbot
    --
    Dickimaw Books
    Home: https://www.dickimaw-books.com/
    Creating a LaTeX Minimal Example: https://www.dickimaw-books.com/latex/minexample/
    LaTeX Resources: https://www.dickimaw-books.com/latexresources.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulrich D i e z@21:1/5 to All on Tue Mar 26 11:36:15 2024
    db schrieb:

    Great, thanks. Now, how to make the text "Link to PDF"
    look like a link, e.g. colour it blue?
    Now, how about looking into the fine manual of the hyperref package?

    Ulrich

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dr Eberhard W Lisse@21:1/5 to All on Tue Mar 26 15:46:50 2024
    Seriously?

    there are 60 references to this on google in English and 40 in German.

    It is all in the hyperref manual...

    ep

    On 2024-03-26 10:43 , db wrote:
    On Mon, 25 Mar 2024 17:39:47 +0000, Nicola Talbot wrote:
    [...]
    Great, thanks. Now, how to make the text "Link to PDF"
    look like a link, e.g. colour it blue?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulrich D i e z@21:1/5 to All on Sun Mar 31 15:33:52 2024
    db wrote:

    [...]
    This works, the link is blue.> But the document also has a table of contents, and> it is rendered all red. I can't find anything in that> manual, nor in hycolor.pdf, on the contents' colour.> How do I suppress that, so that it comes out black?

    The manual of the most recent release of the package hyperref can be
    found at:

    http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/hyperref-doc.pdf

    Depending on the TeX distribution in use by you you can probably use the texdoc-utility for finding the manual belonging to the hyprref-release installed on your computer.

    On my system I can type the command

    texdoc hyperref

    on the shell and my pdf-viewer is launched and shows the manual of the
    hyperref manual.

    Section "5.6 Extension options" says:

    | colorlinks boolean false Colors the text of links and anchors.
    | The colors chosen depend on the type of
    | link. At present the only types of link
    | distinguished are citations, page
    | references, URLs, local file references,
    | and other links. Unlike colored boxes,
    | the colored text remains when printing.
    | linkcolor color red Color for normal internal links.
    | anchorcolor color black Color for anchor text. Ignored by most
    | drivers.
    | citecolor color green Color for bibliographical citations in
    | text.
    | filecolor color cyan Color for URLs which open local files.
    | menucolor color red Color for Acrobat menu items.
    | runcolor color filecolor Color for run links (launch
    | annotations).
    | urlcolor color magenta Color for linked URLs.
    | allcolors color Set all color options (without border
    | and field option.)
    | frenchlinks boolean false Use small caps instead of color for
    | links.
    | hidelinks Hide links (removing color and border).

    Links in the table of contents are internal links, so you can change
    the color of links of the table of contents to black via

    \hypersetup{colorlinks,linkcolor=black}

    For having all links, not just internal links, without color/border
    you can use the option hidelinks:

    \hypersetup{hidelinks}

    You can switch color of all internal links only with links belonging to
    the table of contents to black by adding \hypersetup-commands to the
    .toc-file (which holds the data of the table of contents) via

    \AtBeginDocument{\addtocontents{toc}{\begingroup\protect\hypersetup{linkcolor=black}}}
    \AtEndDocument{\addtocontents{toc}{\endgroup}}

    You can turn off both coloring of links and adding borders to links
    only with all links belonging to the table of contents by adding \hypersetup-commands to the .toc-file (which holds the data of the
    table of contents) via

    \AtBeginDocument{\addtocontents{toc}{\begingroup\protect\hypersetup{hidelinks}}}
    \AtEndDocument{\addtocontents{toc}{\endgroup}}

    Sincerely

    Ulrich

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)