2

I am a green hand in LaTeX. I sought online and found a lot of posts about the question I asked. However, I cannot follow their instructions. Could anyone give me a hand ? (OS is ubuntu 12.04.)

The example code are as follows:

\url{http://www.coreavc.com/index.php?option=com_content&task=view&id=27&Itemid=1com/index.php?option=com_content&task=view&id=27&Itemid=1}

what is the LaTeX code which can wrap this long URL?

The latex code I have is: enter image description here enter image description here

The result is like this. For URLs, they do not wrap automatically but go out of the page. enter image description here

  • 3
    Welcome to TeX.SX! Seems to work fine as-is for me. i.stack.imgur.com/qMhKG.png Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Sean Allred Jan 12 '14 at 22:55
  • 3
    Welcome to TeX.SE! There are quite a few postings on this site about typesetting long URL strings. (E.g., go to the tags page and search for the url tag.) Please consider posting an MWE (minimum [non]working example of what you've tried doing so far. – Mico Jan 12 '14 at 22:59
  • Thanks for your help. I have solved it. The system I used is Ubuntu 12.04. I have added some figures for my problem. To solve it, we need to add one package: \usepackage{breakurl} – tqjustc Jan 12 '14 at 23:43
  • 2
    Adding a minimal working example does not mean adding an image with some code in it! You should have make a copy of this code and edit this into your question. – Speravir Jan 13 '14 at 1:15
  • 1
    failure to break urls in a hyperref document is a common problem if you're using the latex→dvips→pstopdf route. i believe that, if you use pdflatex, the problem won't arise. – wasteofspace Jan 13 '14 at 12:08
2

Another approach: Split the linked URL and the link text with \href:

\documentclass{scrartcl} 
\usepackage{hyperref}
\begin{document}

Only Domain:
\href{http://www.coreavc.com/index.php?option=com_content&task=view&id=27&Itemid=1com/index.php?option=com_content&task=view&id=27&Itemid=1}{http://www.coreavc.com}

Domain with description:
\href{http://www.coreavc.com/index.php?option=com_content&task=view&id=27&Itemid=1com/index.php?option=com_content&task=view&id=27&Itemid=1}{http://www.coreavc.com Subpage I want}

Domain with description:
\href{http://www.coreavc.com/index.php?option=com_content&task=view&id=27&Itemid=1com/index.php?option=com_content&task=view&id=27&Itemid=1}{http://www.coreavc.com Start $\to$ Menu 1 $\to$ Menu2}

\end{document}

Text with marked links

Remark for the 3rd version (navigation path): There you can describe how you can find the page via web navigation (or menu pathes). This may also help a reader, if the link will break in future - unless the webpage is reorganized completely.

There are also packages to print menus, e.g. menukeys

0

I had a similar problem once and I managed to get a solution I could live with by using the command \sloppy

\sloppy allows Latex for a more flexible handling of line breaks. The command \fussy turns the standard behaviour back on.

So, my solution looked like that

% parts of the document
\sloppy

% the paragraph containing the very long URL

\fussy
% the rest of the document
  • 2
    \begin{sloppypar} ... \end{sloppypar} has the same effect as \sloppy ... \fussy and perhaps more clearly indicates that there's an intended and defined scope. – barbara beeton Jan 13 '14 at 14:26
  • Your are definitely right. This gives the source code more structure. – Dohn Joe Jan 14 '14 at 8:24
-1

another point of view, use a shorter url --- https://bitly.com/ --- which looks better and it forwards an interested user towards your long url. concerning your content, it is clear that you are writing about eclipse within the footnote(s). hence, no need that a long eclipse url is stated within the footnote(s).

  • 2
    But these links don't always last very long and are out of your control. – Chris H Jan 13 '14 at 9:54
  • till now, had never a prob with bitmarks. when registering, you have an overview about your links (for instance, clicks). obviously, i cannot guarantee that every bitmark exists forever. (maybe they have implemented a deletion strategy for unused links) – mnemonic Jan 13 '14 at 11:27
  • Fair enough, I read your answer as a general one about url shorteners rather than a specific recommendation, and I've has issues with others in the past. – Chris H Jan 13 '14 at 12:39
  • Even with such a shortened URL the issue of the OP can appear, when the URL is at the very end of a line, so you do not provide a true solution. Apart from this: URL shorteners hide the real source, what I strongly dislike. – Speravir Jan 14 '14 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.