如何在latex中使用Tablerx时将文本包装在单元格内?

如何在latex中使用Tablerx时将文本包装在单元格内?,latex,Latex,不要将URL写为文本。有像url或hyperref这样的包,它们为它们提供了一个专用的\url{}宏。这还可以避免手动转义所有特殊字母 要使更多可能的断点挤入到缩小列的方式中,请尝试xurl包 切勿使用双字母字体命令,如\bf,它们已被弃用 请看一些关于专业外观表的建议。要点:不要使用垂直线 \begin{tabularx}{\textwidth}{|c|X|X|c|} \hline S.no & \multicolumn{1}{|c|}{\textbf{headline}} &

  • 不要将URL写为文本。有像
    url
    hyperref
    这样的包,它们为它们提供了一个专用的
    \url{}
    宏。这还可以避免手动转义所有特殊字母

  • 要使更多可能的断点挤入到缩小列的方式中,请尝试
    xurl

  • 切勿使用双字母字体命令,如
    \bf
    ,它们已被弃用

  • 请看一些关于专业外观表的建议。要点:不要使用垂直线


\begin{tabularx}{\textwidth}{|c|X|X|c|}

\hline
S.no & \multicolumn{1}{|c|}{\textbf{headline}} & \multicolumn{1}{|c|}{\textbf{article\_link}} & \bf\Centering is\_sarcastic \\ \hline
1 &
  man who said 'yes' to life found with mountain bike at bottom of gorge &
  {https://local.theonion.com/man-who-said-yes-to-life-found-with-mountain-bike-at-bo-1819573183} &
  1\\
\hline 
2 &
  tina fey is worried about what the internet is doing to society &
  {https://www.huffingtonpost.com/entry/tina-fey-internet\_us\_5848252ce4b08c82e888ff80} &
  0 \\
\hline 
3 &
  why a woman refuses to leave her husband who threatened to kill her &
  {https://www.huffingtonpost.com/entry/pro-fighter-allegedly-abuses-wife\_n\_6072618.html} &
  0 \\ \hline
\end{tabularx}
\documentclass{article}

\usepackage{tabularx}
\usepackage{xurl}


\begin{document}

\begin{tabularx}{\textwidth}{|c|X|X|c|}
\hline
S.no & \textbf{headline} & \textbf{article\_link} &  \textbf{is\_sarcastic} \\ \hline
1 &
  man who said 'yes' to life found with mountain bike at bottom of gorge &
  \url{https://local.theonion.com/man-who-said-yes-to-life-found-with-mountain-bike-at-bo-1819573183} &
  1\\
\hline 
2 &
  tina fey is worried about what the internet is doing to society &
  \url{https://www.huffingtonpost.com/entry/tina-fey-internet_us_5848252ce4b08c82e888ff80} &
  0 \\
\hline 
3 &
  why a woman refuses to leave her husband who threatened to kill her &
  \url{https://www.huffingtonpost.com/entry/pro-fighter-allegedly-abuses-wife_n_6072618.html} &
  0 \\ \hline
\end{tabularx}

\end{document}