
後で手動でテキストを入力するドキュメント用のテーブルを作成しようとしていますtabularx
。したがって、当然、入力が複数行にまたがる行が必要です。
\\
次の行に移動できることはわかっていますが、この表に必要な境界線がこの行の右側に生成されません。
サンプルコードは次のとおりです。
\begin{table}[htb]
\begin{tabularx}{\textwidth}{|l|X|}
\hline
Foo & bar\\ \hline
Multiline \\ \\ \\ & Span this row for multiple lines for writing input\\ \hline
\end{tabularx}
\end{table}
答え1
表の右端に縦棒を追加するには、次のように変更する必要があります。
Multiline \\ \\ \\ & Span this ...
に
Multiline & \\ & \\ & \\ & Span this ...
完全な MWE (最小限の動作例)
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[htb]
\begin{tabularx}{\textwidth}{|l|X|}
\hline
Foo & bar\\
\hline
Multiline & \\ % no text in second column
& \\ & \\ % no text in either column, for 2 rows
& Span this row for multiple lines for writing input\\
\hline
\end{tabularx}
\end{table}
\end{document}
答え2
\\
多数必要な場合に、sの数を数える手間を省くためのバリエーション:
\documentclass{article}
\usepackage{geometry}
\usepackage{tabularx}
\begin{document}
\begin{table}[htb]
\setlength{\extrarowheight}{2pt}
\begin{tabularx}{\textwidth}{|l|X|}
\hline
Foo & bar\\
\hline
Multiline & \\ % no text in second column
& \rule{0pt}{10\baselineskip}\\
& Span this row for multiple lines for writing input\\
\hline
\end{tabularx}
\end{table}
\end{document}