Tag Info

Hot answers tagged

32

The following example uses hyperref (the question has mentioned "hyperlinking") and hooks into \hyper@linkurl to get the URLs. The catched URLs are written into an index file \jobname-url.idx: \urlentry{<hex coded URL>}{<page number>} The URL are hex encoded to avoid trouble with special characters. Package filecontents helps to create a ...


20

The following solution does not (anymore) use ImageMagick's convert command as this would always create raster images, which will stand out from the text. Instead, it uses Ghostscript to vectorise the letters so that they appear like normal text but are in fact an uncopyable image. Note that you also have to run pdflatex with the --shell-escape switch ...


14

Atention: the following code works only for simple URLs, that is, URLs that do not contain special characters, like %. For a complete solution, please refer to Heiko's answer. As Nicola mentioned in the comments, redefining \url might be an interesting idea, but some characters in the URL might cause problems. Sadly my TeX-fu isn't good enough to ...


14

tex/xelatex/xetexurl/url.sty The old url.sty had used 8-bit characters that break with XeTeX's expectations of input encoded with UTF-8. Thus the file in tex/xelatex/xetexurl/url.sty is a patched version: % url.sty ver 3.1 15-Mar-2004 Donald Arseneau ... ... % Byte codes >= 0x80 replaced by ^^xx sequences - JK, 2006-04-07 Since version 3.3 ...


13

Hacking \UrlBreaks is not needed for \url inside the bibliography of biblatex. Package biblatex uses \biburlsetup and has already added lots of characters. The breaking at some character classes is controlled by counters. From the documentation of biblatex, "4.10.3 User-definable Lengths and Counters": biburlnumpenalty: If this counter is set to a value ...


12

biblatex has a number of counters which when set to non-zero positive values less than 10000 allow breaks in urls in the bibliography. The specific counters are biburlnumpenalty biburlucpenalty biburllcpenalty for breaks after numbers, uppercase letters and lowercase letters, respectively. In your case it suffices to set the lowercase penalty to 9000; ...


12

Just type the URL: \documentclass{article} \usepackage{url} \begin{document} \url{http://foo.bar/orders{orderID}} \end{document} With hyperref it's the same, but the result is an invalid URL, I guess.


11

The syntax of \hyperref with the optional argument is: \hyperref[<label name>]{<text>} I assume, you do not have \label{This is a link to Google}. Then the text "http://www.google.com" appears without link to a non-existing label. I think you want somethink like: \href{https://www.google.com/}{This is a link to Google.} Then the text "This ...


10

The PDF format knows nested actions. hyperref supports this by option nextacrtionraw for \href in some rudimentary manner: \documentclass{article} \usepackage{hyperref} \begin{document} \href[% nextactionraw={% <<% /Type/Action% /S/URI% /URI(http://meta.tex.stackexchange.com/)% >>% }% ...


10

You can load the package url and redefine the command \url as follows: \DeclareUrlCommand\url{\color{magenta}\def\UrlLeft{http://}\urlstyle{tt}} Note that the xcolor package is required, too, if you want to give a color to the link. Now you can simply write \url{ipython.org} and http:// is added automatically. Complete example ...


9

You can redefine the bibmacro doi+eprint+url so that the doi field is printed only if the url field is not defined, that is, add the following lines in the preamble: \renewbibmacro*{doi+eprint+url}{% \iftoggle{bbx:doi} {\iffieldundef{url}{\printfield{doi}}{}} {}% \newunit\newblock \iftoggle{bbx:eprint} {\usebibmacro{eprint}} {}% ...


9

If you want to include the email address as an image but don't want to loose quality, why not use a PostScript image? If Adobe Illustrator is available to you, it's easy to convert any font in a PDF to a vector path. I'm sure there are open source tools that can do the same. Create a New Illustrator Document File > Place... > Select the PDF with your CV ...


8

Here are two approaches. In the first, I use the actual @ character, but when I write it out, I overlay it with some really tiny white text. Thus, during the copy/paste of the PDF, you get the extra text as part of the copy: \documentclass{article} \usepackage{stackengine} \usepackage{graphicx} \usepackage{xcolor} ...


8

From the hyperref documentation (section 4 Additional user macros): If you need to make references to URLs, or write explicit links, the following low-level user macros are provided: \href[options]{URL}{text} The text is made a hyperlink to the URL; this must be a full URL (relative to the base URL, if that is defined). The special characters # ...


8

This works for me, but I don't know about your OS, so I'm not sure if it will work for you. Note that the command convert is part of ImageMagick. Compile with -shell-escape enabled. \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage{bashful,graphicx} \begin{document} \bash echo "jon@jon.com" | convert label:@- email.png \END ...


8

It's better to use a different command, so that its usage is clear: \documentclass{article} \usepackage{xcolor} \usepackage[ colorlinks, linkcolor=magenta ]{hyperref} \newcommand\rurl[1]{% \href{http://#1}{\nolinkurl{#1}}% } \begin{document} This is a link \rurl{ipython.org} written in abbreviated form. \end{document} Of course you lose the tricks ...


7

I have seen/analyzed the problem some time ago. The reason is a buggy PDF viewer (some versions of AR), see giordano's comments. Package hyperref writes the URL into the PDF fil, e.g. pdfTeX or dvips/ps2pdf: /URI(http://www.phy.duke.edu/~rgb/Class/phy319/phy319/node75.html) The more canonical URI would be with percent encoding: ...


7

If biber is used as backend, then one can use the \DeclareSourcemap facilities to change fields. For the case at hand a solution is to remap url entries with dx.doi.org as initial part using the following code: \DeclareSourcemap{ \maps[datatype=bibtex]{ \map{ \step[ % copies url to doi field if it starts with http://dx.doi.org/ ...


7

If you are using the default Computer Modern Fonts, then the Latin Modern fonts might be an alternative, because they are derived from the Computer Modern Fonts. The tilde is lower. Also there is a proportionally spaced typewriter variant that might look better than the mono-spaced font for URLs. \documentclass{letter} \usepackage{url} ...


7

You can set the \UrlFont including a sizing command: \documentclass{article} \usepackage{biblatex} \addbibresource{biblatex-examples.bib} \renewcommand{\UrlFont}{\small\tt} \begin{document} \cite{ctan,markey,kastenholz} \printbibliography \end{document} If you only want this to affect the bibliography, then place the command ...


7

With hyperref, for fun (egreg was tooooo fast with url ;)...) \documentclass{article} \usepackage{hyperref} \begin{document} \href{http://foo.bar/orders{orderID}}{\texttt{http://foo.bar/orders\{orderID\}}} \end{document}


6

You can do this via mapping of datasources. The \DeclareSourcemap command \DeclareSourcemap{ \maps[datatype=bibtex]{ \map{ \step[fieldsource=url,final] \step[fieldset=doi,null] } } } processes any bibtex input data and for each item in the bibliograhpy file it executes a number of commands given by \step: the first step ...


6

There are different approaches. First on LaTeX-level you can use \AtEveryCitekey{\clearfield{url}} \AtEveryBibitem works only for \printbibliography. Or you use a Biber solution: \DeclareSourcemap{ \maps[datatype=bibtex ]{ \map{ \step [ fieldset = url , null ] } } } MWE: \documentclass{article} \usepackage{filecontents} ...


6

The break points set by package url can be configured by setting \UrlBreakPenalty and \UrlBigBreakPenalty. A value of 10000 prevents the hyphenation: \documentclass[12pt,a4paper,oneside]{report} \usepackage{url} \usepackage{apacite} \usepackage[T1]{fontenc} \usepackage[osf]{libertine} \mathchardef\UrlBreakPenalty=10000 \mathchardef\UrlBigBreakPenalty=10000 ...


6

Here a small suggestion: \documentclass[a4paper]{article} \usepackage{hyperref} \makeatletter \newcommand*\makrdownlink[2]{% \immediate\write\@auxout{% \string\expandafter\string\gdef\string\csname\space markdownlink#1\string\endcsname{#2}% }% } \newcommand*\makrdownref[2]{% \@ifundefined{markdownlink#1} {\typeout{Undefined ...


6

If biber is used as a backend the solution is to use \DeclareSourcemap to clean the url. \DeclareSourcemap{ \maps[datatype=bibtex]{ \map{ \step[fieldsource=url, match=\regexp{\\_}, replace=\regexp{_}] } } }


6

With backref active, the entire bibliography record in the .bbl file is read as an argument, so the category code tricks made by \url don't work. However, the IEEEtran bib style provides the hook \BIBdecl that's executed at the start of the bibliography; use it to make % into a printable character. The produced .bbl file shouldn't have comments after ...


6

One way to proceed is to create a modified version of the file plainnat.bst, in which the functions that format and print fields such as doi and isbn are reduced to stubs that do nothing: Find the file plainnat.bst in your TeX distribution. Make a copy of this file and call it, say, myplainnat.bst. (Don't edit an original file of the TeX distribution ...


5

You're correct. The backslash is TeX's (default) escape character; it signals to TeX that what follows is different from "normal text". Therefore, simply typing \ will not produce a backslash in the output. (Incidentally, if you type \ followed by any amount of blank space, you will only produce a so-called control space, not a backslash.) To typeset a ...


5

This is because \url doesn't find an appropriate breaking point in the given URL; you can help it, by adding a new possible breaking point to \UrlBreaks (the default list for possible breaks): \begin{filecontents*}{abcd.bib} @misc{pcons, author = {Energy.Gov}, title = {{Estimating Appliance and Home Electronic Energy Use}}, Howpublished = ...



Only top voted, non community-wiki answers of a minimum length are eligible