如何在表格中包装网址?

如何在表格中包装网址?

表格中的所有文本都换行了,除了第 13 行(我已将其复制到下方)。网站跑到了页面的一侧。我希望网址换行。有人能帮忙吗?

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{longtable}
\begin{document}
\maketitle
\begin{center}
\begin{longtable}{|l|p{13cm}|}
\caption[]{Disqus IT} \label{DisqusIT} \\
\hline \multicolumn{1}{|c|}{\textbf{ Sample }} & \multicolumn{1}{p{13cm}|}{\textbf{Text}} \\ \hline 
\endfirsthead
\multicolumn{2}{c}%
{{\bfseries \tablename\ \thetable{} -- Disqus IT continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{ Sample }} &
\multicolumn{1}{c|}{\textbf{Text}} \\ \hline 
\endhead
\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
  13 I really really really really like to think about this stuff: http://www.senate.gov/legislative/LIS/roll\_call\_lists/roll\_call\_vote\_cfm.cfm?congress=113\&session=1\&vote=00032 \\ 
\end{longtable}
\end{center}
\end{document}

答案1

在不允许换行的表格列中放置这么长的 URL 是没有意义的。使用包,然后您可以使用行为类似于 的ltablex环境。该包可在 tabularxlongtablehttp://www.ctan.org/tex-archive/macros/latex/contrib/ltablex

它没有正确的许可证声明。这就是为什么它不在 TeXLive 上,也许也不在 MikTeX 上的原因。

\documentclass{article}
\usepackage{ltablex}
\usepackage{url}
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{|X|p{13cm}|}
\caption{Disqus IT \label{DisqusIT}} \\\hline 
\multicolumn{1}{|c|}{\textbf{ Sample }} & \multicolumn{1}{p{13cm}|}{\textbf{Text}} \\ \hline 
\endfirsthead
\multicolumn{2}{c}{{\bfseries \tablename\ \thetable{} -- Disqus IT continued from previous page}} \\\hline
\multicolumn{1}{|c|}{\textbf{ Sample }} & \multicolumn{1}{c|}{\textbf{Text}} \\ \hline 
\endhead
\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot

  13 I really like to think about this stuff: \url{http://www.senate.gov/legislative/LIS/roll_call_lists/roll_call_vote_cfm.cfm?congress=113&session=1&vote=00032} & 
\end{tabularx}

\end{document}

在此处输入图片描述

相关内容