![如何在表格中包装网址?](https://linux22.com/image/265787/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%A1%A8%E6%A0%BC%E4%B8%AD%E5%8C%85%E8%A3%85%E7%BD%91%E5%9D%80%EF%BC%9F.png)
表格中的所有文本都换行了,除了第 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
环境。该包可在
tabularx
longtable
http://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}