1

Im making a table where the last column contains a URL which may be quite large, so I want to make automatic line breaks in this column.

If I use p{3in} in the table, some of the URL are seen as one word, and line breaks will only happen when certain characters appears in the URL. If these characters does not appear it will simply let the URL go outside the table.

How can i force the table make the URL fit into the cell?

\begin{sidewaystable}
\begin{center}
\begin{tabular}{l c c c c p{8cm}}
\toprule
Name & Brand & CPU & RAM & Price & URL \\
\midrule
POWEREDGE R210 II E3-1270V2 3.5-8MB 16GB 2X4TB & DELL   & Xeon Q-core 3,5Ghz    & 16Gb  & 8939  & \url{http://www.dustin.dk/product/5010745980/dell-poweredge-r210-ii-e3-1270v2-3-5-8mb-16gb-2x4tb/}\\
\bottomrule
\end{tabular}
\end{center}
\end{sidewaystable}

migrated from stackoverflow.com Oct 18 '13 at 1:13

This question came from our site for professional and enthusiast programmers.

  • 1
    Welcome to TeX.SX! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same ID), otherwise you won't be able to comment on or accept answers or edit your question. – texenthusiast Oct 18 '13 at 1:39
  • Welcome to TeX.SX! 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}. – jub0bs Oct 18 '13 at 8:28
1

In this case you can use the hyphens option to the url package to allow line breaks at dashes:

Sample output

\documentclass{article}

\usepackage[hyphens]{url}
\usepackage{rotating,booktabs}

\begin{document}

\begin{sidewaystable}
\begin{center}
\begin{tabular}{l c c c c p{3cm}}
\toprule
Name & Brand & CPU & RAM & Price & URL \\
\midrule
POWEREDGE R210 II E3-1270V2 3.5-8MB 16GB 2X4TB & DELL   & Xeon Q-core
3,5Ghz    & 16Gb  & 8939  & 
\url{http://www.dustin.dk/product/5010745980/dell-poweredge-r210-ii-e3-1270v2-3-5-8mb-16gb-2x4tb/}\\
\bottomrule
\end{tabular}
\end{center}
\end{sidewaystable}
\end{document}

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.