Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to produce a tilde in LaTeX for a website?

Tags:

latex

tilde

Following the previous questions on this topic, when you produce a website in LaTeX what is the best way to produce a url that contains a tilde? \verb produces the upper tilde that does not read well, and $\sim$ does not copy/pase well (adding a space when I do it). Solutions?

It seems like this should be one of those things that has a very easy fix... if it doesn't, why not?

like image 332
physicsmichael Avatar asked Apr 05 '09 06:04

physicsmichael


People also ask

How do you make a tilde symbol in overleaf?

You may ask how one can write a tilde symbol in LaTeX? short answer: writing a tilde in LaTeX over a letter can be achieved easily using the command \tilde{symbol} or as a symbol within the text (or math mode) using \textasciitilde (or $\sim$), respectively.

How do I display a tilde?

3. Using the Tilde Symbol Shortcut (Windows and Mac) The keyboard shortcut for Tilde Symbol is Shift + ` for both Windows and Mac. Alternatively, for Windows, use the Alt Code method by pressing down the alt key and typing the alt code of 126 on the numeric keypad.

What is tilde used for in LaTeX?

The meaning of these characters are: ~ (tilde) unbreakable space, use it whenever you want to leave a space which is unbreakable, and cannot expand or shrink, as e.q. in names: A. ~U.

Can tilde have URL?

A tilde in a URL usually is followed by a user name and indicates that the files below that URL come from that user's home directory. Show activity on this post. ~ refers to your home directory. If it is in the URL it means that the cpanel is located relative to your home directory.


2 Answers

I'd look at the url package.

like image 176
Jon Ericson Avatar answered Sep 28 '22 15:09

Jon Ericson


I know this is an old question, but I recently came up with something that, despite a severe lack of elegance, works beautifully.

\catcode`~=11 % make LaTeX treat tilde (~) like a normal character
\newcommand{\urltilde}{\kern -.15em\lower .7ex\hbox{~}\kern .04em}
\catcode`~=13 % revert back to treating tilde (~) as an active character

Now you can use \urltilde inside of a \url tag (even in a .bib file) and: 1) the URL will render perfectly; 2) clicking on the URL will take you to the correct address; and, 3) copy-paste will put the correct address in the clipboard.

This is the only solution I have found that satisfies all three of these requirements. I hope it helps somebody out there.

like image 27
Ryan Avatar answered Sep 28 '22 16:09

Ryan