如何將網址包裹在表格中?

如何將網址包裹在表格中?

除了我在下面複製的第 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}

在此輸入影像描述

相關內容