2

I am writing a URL in a web reference in latex. The link contains this special character ~ that when I compile the tex file to PDF, it disappear. The link becomes invalid.

How can I add the special character (~) to my URL in latex reference file (.bib)?

EDIT: The solution of using \url{} will not work with me as this is not a text URL but a bibliography. Here is the script. I use IEEE conference template.

\documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}
\begin{document}
\title{Test}
\maketitle

This is \cite{citeme}.

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,ref}
\end{document}

The ref file is:

%%
%% WinShell 3.3.2.6
%% http://www.winshell.org/
%%

% Strings


% Preamble


% BibTeX Entries
@misc{citeme,
 author               = {MyName},
 title                = {XYZ},
 url                  = {https://www.xxx/~vvv},
 year                 = {2014},
 }

The output as shown below does not include the ~ sign in the URL which make it unreachable link when clicked from the PDF. enter image description here

Sebastiano
  • 54,118
  • 2
    Welcome to TeX SX: Load the url package, and use \url{...}. – Bernard Jan 07 '18 at 00:43
  • Thanks. I did. I use misc as a type of the reference. I used \url{...} in the url field. I got the URL correct with the special character. However, the \url{} appears in the copiled version in the PDF surrounding the URL. Where should I place the \url{myurl}? –  Jan 07 '18 at 01:43
  • Why don't you use biblatex? It defines the online reference type, loads url and is easier to customise. – Bernard Jan 07 '18 at 01:53
  • 2
    You shouldn't need \url{} in a url field if you're using a suitable style and encoding etc. Biblatex is easiest, as @Bernard says, but there are BibTeX styles which can handle a url field correctly. However, we don't currently know anything about your code except that it doesn't do what you want. So it is hard to say much. Posting an MWEB would probably get you more effective help. – cfr Jan 07 '18 at 01:56
  • 1
    I tried your MWE, and adding Bernard's\cfr's suggestions, it works fine here. That is, you already included your url in the url field. But you didn't load the package. So add \usepackage{url} to your preamble. If you want it to be clickable, add hyperref instead. – gusbrs Jan 07 '18 at 19:08
  • Ah, you probably also don't want IEEEabrv in your \bibliography call, that would be a \bibliographystyle. – gusbrs Jan 07 '18 at 19:11
  • 1
    @gusbrs IEEEabrv is actually a .bib file with journal abbreviations, so \bibliography is just fine. – samcarter_is_at_topanswers.xyz Jan 07 '18 at 22:34
  • @samcarter, I didn't know that! – gusbrs Jan 07 '18 at 22:50

0 Answers0