How do I horizontally compress or unstretch paragraph text?
My references section sometimes shows a lot of whitespace between words that I would like to remove.
For example, in the following screenshot, I would like to remove the extra spaces within the text "Describing a link":
I know that I can use mbox (for example, mbox{Describing a link}
), but I'd like to apply some option to avoid this globally.
Update: The main answer worked for url
, but now I get the same issue when using href
:
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
Here is the full example document:
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % Added based on the initial answer
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
end{thebibliography}
end{document}
hyperref urls white-space
add a comment |
My references section sometimes shows a lot of whitespace between words that I would like to remove.
For example, in the following screenshot, I would like to remove the extra spaces within the text "Describing a link":
I know that I can use mbox (for example, mbox{Describing a link}
), but I'd like to apply some option to avoid this globally.
Update: The main answer worked for url
, but now I get the same issue when using href
:
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
Here is the full example document:
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % Added based on the initial answer
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
end{thebibliography}
end{document}
hyperref urls white-space
May I ask why you do not want to useurl{mailto:testlongname@example.com}
?
– Kurt
Jan 4 at 2:04
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
1
Well, packagesurl
andxurl
are prepared to work with commandurl
but not withhref{}{}
. Because the second parameter ofhref
is set as normal text you can tryhref{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...
– Kurt
Jan 4 at 2:52
@Kurt Thanks, that's good to know. I'll probably just useurl
.
– freeradical
Jan 4 at 6:25
add a comment |
My references section sometimes shows a lot of whitespace between words that I would like to remove.
For example, in the following screenshot, I would like to remove the extra spaces within the text "Describing a link":
I know that I can use mbox (for example, mbox{Describing a link}
), but I'd like to apply some option to avoid this globally.
Update: The main answer worked for url
, but now I get the same issue when using href
:
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
Here is the full example document:
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % Added based on the initial answer
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
end{thebibliography}
end{document}
hyperref urls white-space
My references section sometimes shows a lot of whitespace between words that I would like to remove.
For example, in the following screenshot, I would like to remove the extra spaces within the text "Describing a link":
I know that I can use mbox (for example, mbox{Describing a link}
), but I'd like to apply some option to avoid this globally.
Update: The main answer worked for url
, but now I get the same issue when using href
:
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
Here is the full example document:
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % Added based on the initial answer
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
bibitem{Reference2} Some Name, href{mailto:testlongname@example.com}{testlongname@example.com}
end{thebibliography}
end{document}
hyperref urls white-space
hyperref urls white-space
edited Jan 4 at 1:16
freeradical
asked Jan 3 at 23:08
freeradicalfreeradical
405
405
May I ask why you do not want to useurl{mailto:testlongname@example.com}
?
– Kurt
Jan 4 at 2:04
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
1
Well, packagesurl
andxurl
are prepared to work with commandurl
but not withhref{}{}
. Because the second parameter ofhref
is set as normal text you can tryhref{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...
– Kurt
Jan 4 at 2:52
@Kurt Thanks, that's good to know. I'll probably just useurl
.
– freeradical
Jan 4 at 6:25
add a comment |
May I ask why you do not want to useurl{mailto:testlongname@example.com}
?
– Kurt
Jan 4 at 2:04
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
1
Well, packagesurl
andxurl
are prepared to work with commandurl
but not withhref{}{}
. Because the second parameter ofhref
is set as normal text you can tryhref{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...
– Kurt
Jan 4 at 2:52
@Kurt Thanks, that's good to know. I'll probably just useurl
.
– freeradical
Jan 4 at 6:25
May I ask why you do not want to use
url{mailto:testlongname@example.com}
?– Kurt
Jan 4 at 2:04
May I ask why you do not want to use
url{mailto:testlongname@example.com}
?– Kurt
Jan 4 at 2:04
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
1
1
Well, packages
url
and xurl
are prepared to work with command url
but not with href{}{}
. Because the second parameter of href
is set as normal text you can try href{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...– Kurt
Jan 4 at 2:52
Well, packages
url
and xurl
are prepared to work with command url
but not with href{}{}
. Because the second parameter of href
is set as normal text you can try href{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...– Kurt
Jan 4 at 2:52
@Kurt Thanks, that's good to know. I'll probably just use
url
.– freeradical
Jan 4 at 6:25
@Kurt Thanks, that's good to know. I'll probably just use
url
.– freeradical
Jan 4 at 6:25
add a comment |
1 Answer
1
active
oldest
votes
In your case you can simply add usepackage{xurl}
in your preamble. Be sure to call xurl
before package hyperref
(if you omit that, hyperref
itself calls package url
with the result you got ...)!
With the following code
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % <===================================================
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
end{thebibliography}
end{document}
you get the result:
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked forurl
, but now I get the same issue when usinghref
. I updated the question and example document to show the new issue.
– freeradical
Jan 4 at 0:56
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468474%2fhow-do-i-horizontally-compress-or-unstretch-paragraph-text%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your case you can simply add usepackage{xurl}
in your preamble. Be sure to call xurl
before package hyperref
(if you omit that, hyperref
itself calls package url
with the result you got ...)!
With the following code
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % <===================================================
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
end{thebibliography}
end{document}
you get the result:
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked forurl
, but now I get the same issue when usinghref
. I updated the question and example document to show the new issue.
– freeradical
Jan 4 at 0:56
add a comment |
In your case you can simply add usepackage{xurl}
in your preamble. Be sure to call xurl
before package hyperref
(if you omit that, hyperref
itself calls package url
with the result you got ...)!
With the following code
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % <===================================================
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
end{thebibliography}
end{document}
you get the result:
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked forurl
, but now I get the same issue when usinghref
. I updated the question and example document to show the new issue.
– freeradical
Jan 4 at 0:56
add a comment |
In your case you can simply add usepackage{xurl}
in your preamble. Be sure to call xurl
before package hyperref
(if you omit that, hyperref
itself calls package url
with the result you got ...)!
With the following code
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % <===================================================
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
end{thebibliography}
end{document}
you get the result:
In your case you can simply add usepackage{xurl}
in your preamble. Be sure to call xurl
before package hyperref
(if you omit that, hyperref
itself calls package url
with the result you got ...)!
With the following code
documentclass[12pt, a4paper, twocolumn]{article}
usepackage{xurl} % <===================================================
usepackage{hyperref}
hypersetup{colorlinks = true, urlcolor = blue, linkcolor = blue, citecolor = blue}
usepackage[super,comma,sort&compress]{natbib}
usepackage{abstract}
renewcommand{abstractnamefont}{normalfontbfseries}
renewcommand{abstracttextfont}{normalfontsmallitshape}
title{Test Article}
author{Test Author}
begin{document}
twocolumn[
begin{@twocolumnfalse}
maketitle
begin{abstract}
noindent
Test abstract.
newlinenewline
end{abstract}
end{@twocolumnfalse}
]
section{Section1}
Lorem ipsum dolor sit ametcite{Reference1}, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
section{Section2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus nisi ligula. Morbi laoreet ex ligula, vitae lobortis purus mattis vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ac metus ut turpis mollis placerat et nec enim. Duis tristique nibh maximus faucibus facilisis. Praesent in consequat leo. Maecenas condimentum ex rhoncus, elementum diam vel, malesuada ante. Fusce pulvinar, mauris pretium placerat venenatis, lectus ex tempus lacus, id suscipit libero lorem eu augue. Interdum et malesuada fames ac ante ipsum primis in faucibus.
begin{thebibliography}{99}
bibitem{Reference1} Describing a link, url{https://example.com/this_is_a_really_long_link_that_wraps_many_lines}
end{thebibliography}
end{document}
you get the result:
edited Jan 3 at 23:31
answered Jan 3 at 23:16
KurtKurt
35.8k847161
35.8k847161
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked forurl
, but now I get the same issue when usinghref
. I updated the question and example document to show the new issue.
– freeradical
Jan 4 at 0:56
add a comment |
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked forurl
, but now I get the same issue when usinghref
. I updated the question and example document to show the new issue.
– freeradical
Jan 4 at 0:56
Thanks! That worked.
– freeradical
Jan 3 at 23:25
Thanks! That worked.
– freeradical
Jan 3 at 23:25
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
@freeradical You are welcome!
– Kurt
Jan 3 at 23:33
Update: The main answer worked for
url
, but now I get the same issue when using href
. I updated the question and example document to show the new issue.– freeradical
Jan 4 at 0:56
Update: The main answer worked for
url
, but now I get the same issue when using href
. I updated the question and example document to show the new issue.– freeradical
Jan 4 at 0:56
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468474%2fhow-do-i-horizontally-compress-or-unstretch-paragraph-text%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
May I ask why you do not want to use
url{mailto:testlongname@example.com}
?– Kurt
Jan 4 at 2:04
@Kurt That would work although I don't like seeing "mailto:" in the display for the link, so it's purely a personal preference.
– freeradical
Jan 4 at 2:20
1
Well, packages
url
andxurl
are prepared to work with commandurl
but not withhref{}{}
. Because the second parameter ofhref
is set as normal text you can tryhref{mailto:testlongname@example.com}{testlongname@example. com}
(I added an blank in the second parameter to allow there a break) ... But you need to this manually for each issue ...– Kurt
Jan 4 at 2:52
@Kurt Thanks, that's good to know. I'll probably just use
url
.– freeradical
Jan 4 at 6:25