# Tag Info

## Hot answers tagged urls

7

\documentclass{article} \usepackage{hyperref} \newcommand\rurl[1]{\xurl#1\empty\empty\empty\empty\empty\xurl} \def\xurl#1#2#3#4#5#6\xurl{% \def\tmp{#1#2#3#4#5}% \href{\ifx\tmp\xurlhttp \else http://\fi#1#2#3#4#5#6}% {\nolinkurl{#1#2#3#4#5#6}}% } \def\xurlhttp{http:} \begin{document} \rurl{ipython.org}\\ \rurl{http://ipython.org} \end{document}

7

You just need to customise the formatting hyperref uses. For example: \documentclass{article} \usepackage[colorlinks=true,urlcolor=blue]{hyperref} \begin{document} \href{http://google.ru/}{GOOGLE} \end{document}

7

Even if the urls are turned off at TOC, they may appear in other places like the headers. Hence it is better to use the optional argument of \section \documentclass{article} \usepackage[% unicode, colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue]% {hyperref} \begin{document} \tableofcontents ...

6

As I hinted in a comment, even if Sharelatex allows to use lualatex as compiler for your documents, it does not allow network connections from luatex code. I performed the following test: Wrote the following testing file, which attempts a connection to Google Geocoding API to get a JSON containing geocoding information about the location "1600 Amphitheatre ...

6

A penalty of 10000 forbids breaks. Set the penalties to smaller values: \documentclass[fontsize=12pt,paper=a4,]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \usepackage{biblatex} \addbibresource{bib.bib} \setcounter{biburlnumpenalty}{100} \setcounter{biburllcpenalty}{100} \setcounter{biburlucpenalty}{100} ...

6

My feeling is that luaotfload makes LuaTeX ignore the choice of stylistic sets when the font is used in math mode. In order to prove my claim, I did \mathcode=\numexpr"7000+\mathcode\relax and tried $\mathtt{`}$, which resulted in the curly backquote no matter what stylistic set in used in the definition of the mono font. Note that url typesets the ...

6

since the purpose of this code is simply to list out the web sites, i have two suggestions: forget align*. instead use the enumerate environment and enter the urls with \verb+...+ as suggested by R. Schumacher. as previous, but instead of \verb, add \usepackage{url} and enter the site addresses as \url{...}. enumerate will take care of numbering and ...

6

\documentclass{article} \usepackage{url} \usepackage{pgffor} \usepackage{xparse} \usepackage{xstring} \usepackage[colorlinks=true]{hyperref} \NewDocumentCommand{\FormatLinks}{% s% #1 =* not used yet O{}% #2 = optional title m% #3 = Mandatory title m% #4 = URL Link }{% \par \hspace*{1.0cm}\href{#4}{#3\IfValueT{#2}{~#2}}% }% ...

5

A minimal example reproducing the error is: \documentclass{article} \usepackage{hyperref} \begin{document} \footnote{\href{http://whatever}} \end{document} The solution: hyperref's \href has two arguments: \href{URL}{text}. Either use both or use \url{URL}: \documentclass{article} \usepackage{hyperref} \begin{document} ...

5

\href can be redefined locally: \begingroup \renewcommand*{\href}[2]{#2} \tableofcontents \endgroup

4

From the url documentation: You can allow some spacing around the breakable characters by assigning \Urlmuskip = 0mu plus 1mu (with mu units because of math mode). In your case it seems to don't suffice, so you can try with: \Urlmuskip=0mu plus 2mu MWE: \documentclass[a4paper,11pt]{book} \usepackage[T1]{fontenc} ...

4

I would recommend against trying to import data directly into LaTeX from a REST/JSON API. This would in any case require outside tools as LaTeX cannot open network connections. I'd suggest to use a language like Python or Ruby to query the API and to transform the JSON data into something that is easier to process with LaTeX. A great tool for transforming ...

4

\documentclass[12pt]{article} \usepackage[hyphens]{url} \usepackage[T1]{fontenc} \usepackage{fouriernc} \begin{document} This is a {\def\UrlBreaks{\do\y}% \url{http://reallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongurl}} which \LaTeX\ will be unhappy about. So, how can we split this in the best way? Here is another one which I don't ...

4

Not sure I'd use xstring if you already have l3 and pgf loaded but anyway: \documentclass{article} \usepackage{url} \usepackage{pgffor} \usepackage{xparse} \usepackage{xstring} \usepackage[colorlinks=true]{hyperref} \NewDocumentCommand{\FormatLinks}{% s% #1 =* not used yet O{}% #2 = optional title m% #3 = Mandatory title m% #4 = URL ...

4

If you help biblatex and hyperref figure out which protocol (HTTP, HTTPS, FTP, ...) to use, you should be fine. DOIs appear correctly since biblatex turns the raw doi into the proper hyperlink itself. So the obvious solution is to always specify the protocol properly as in @misc{Hohn.2013, author = {Höhn, Hans-Joachim}, title = {Theologie als ...

4

You have two errors in your hack. First, you leave urldate on stack after your if$statement. This is how you get two dates. You need to use this instance with swap$ instead of putting the third instance of urldate on stack: FUNCTION {format.urldate} { urldate duplicate$empty$ { pop$"" } { "~(Accessed: " swap$ * ")" * } if} However, if ... 4 LaTeX will refuse to break a 'word' if it contains, among a few other characters, a /. This has very solid reasoning that's outside the scope of this answer, but the url LaTeX package will handle these things very cleanly. Instead of typing in the file path directly, use Insert -> URL. This will (presumably) wrap the argument in \url{<my text ... 4 Go to wikipedia and copy its URL as such; then add \ before each %: \documentclass{article} \usepackage{hyperref} \begin{document} \url{http://www.wikiwand.com/pl/Prawo_Lewisa-Mogridge\%E2\%80\%99a} \end{document} EDIT 1 Instead of \url, you can use \href, in case you want the hyperlink: \documentclass{report} \usepackage{hyperref} \begin{document} ... 4 None of the answers helped me out. My long url was placed in a footnote. After searching around I found a working solution here. In my preamble: \usepackage{hyperref} \def\UrlBreaks{\do\/\do-} The last line instructs the url-package which is loaded with the hyperref-package to additionally break at the characters / and -. The option breaklinks=true in ... 4 Because you gave no MWE I had to guess. I used paper=A6 to simulate your column. \documentclass[paper=A6]{scrartcl} \usepackage[hyphens]{url} \makeatletter \g@addto@macro{\UrlBreaks}{\UrlOrds\do\r\do\u\do\b\do\i} \makeatother \usepackage{showframe} % to show typing area and margins \begin{document} text ... 3 URL line breaking in bibliographies is notoriously hard and you will find many questions on this site about it. In your case the ad hoc \apptocmd{\biburlsetup}{\def\UrlBigBreaks{\do\:\do\-\do\/}}% does the trick, the standard is \def\UrlBigBreaks{\do\:\do\-}%, we just added the / character. The url package documentation says (p. 4) The result is ... 3 This was done on a smaller scale for a map of Hawaii using a 20x20 grid. For the final version you set the opacity of the map to 1. I find using a checkerboard background helps when aligning links to the map. Using a \parbox instead of tikz \matrix is much faster. I stole the map from http://www.enchantedlearning.com/usa/states/hawaii/map.GIF and ... 3 Install curl (assuming you use apt-get to install packages) : sudo apt-get install curl and do the following for pdf files: cat document.pdf | grep -ao '[a-zA-Z]\+://[a-zA-Z.-]*[^)]\+' | while read LINE; do curl -o /dev/null --silent --head --write-out '%{http_code}' "LINE"; echo " $LINE"; done and do the following for tex files : cat myfile.tex ... 3 To use url with a plain bibliography style you can use this format: @misc{Doe:2009:Online, author = {author}, title = {Title of Citation}, year = {2010 (accessed December 7, 2014)}, howpublished = "\url{http://www.myurl.com}"} Additionally you need to add the url package \usepackage{url} If you want to use the url attribute in you need to use natbib ... 3 OCG visibility setting for printing is honoured only by Adobe Reader (and perhaps other non-free viewers): \documentclass{article} \usepackage[colorlinks]{hyperref} \usepackage{ocgx} %\usepackage{fixocgx} %dvips+pdf, xelatex, dvipdfmx \begin{document}\Huge See the game \makebox[0pt][l]{% \begin{ocg}[printocg=never]{A}{a}{1} ... 3 Are you allowed to load the url package, though? If so, encase the URL in a \url{...} macro. Issue the instruction \urlstyle{rm} to ensure that the font used for the URL string is the same as the main text font. The following code compiles equally well under pdfLaTeX, XeLaTeX, and LuaLaTeX. \documentclass{article} \usepackage{url} \urlstyle{rm} % roman ... 3 The appearance of citation call-outs is affected by the chosen bibliography style only if no citation management package is in use. Which citation management package, if any, are you working with? If you're working with the natbib package, try loading it with the options numbers and square. I.e., type \usepackage[numbers,square]{natbib} in the ... 3 The penalties are not used in a bibitem, but only in \biburlsetup which is done at the begin of the bibliography. If you want to change the settings for one bibitem, you should call the url setup again: \AtEveryBibitem{% \ifcategory{badbreaks} {\defcounter{biburllcpenalty}{9000}\biburlsetup} {}} Output with OP MWE (\def\mybiburlval{0}): 3 The recently developed Bibulous project handles this directly. For article-type entries in a *.bib file, an example template definition is the following:: article = <au>, \enquote{<title>,} <journal>, <volume>: [<startpage>--<endpage>|<startpage>|<eid>|] (<year>).[ <doi>| <url>| <isbn>| ... 3 You can achieve it by testing if doi is empty inside the function format.url. Replace your format.url by the following: FUNCTION {format.url} { doi empty$ { url duplicate$empty$ { pop$"" } { "\urlprefix\url{" swap$ * "}" * } if$} { "" } if$ }

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