
テーブル環境でコンパクトなリストが必要です。テーブル用の環境が必要で、リストのオプションをtabulary
使用しています。itemize
私の試みは、「何かが間違っています。おそらく \item が欠落しています。」というエラーを返します。
次の MWE は問題を再現します。MikTeX (Windows 上) のすべてのパッケージを更新しました。
\documentclass{article}
\usepackage{tabulary}
\begin{document}
\begin{tabulary}{\linewidth}{L L}
test & \begin{itemize} \item table item 1 \end{itemize} \\
\end{tabulary}
\end{document}
指摘されているように、上記のコードは、itemize
-environment を environment にラップすると機能しますminipage
。
時間とスペースを節約するために、 をcompactitemt
自動的にラップする環境を作成しました。最初はエラーが発生しましたが、次のコードのように環境を再定義すると動作するようitemize
にminipage
なりました。
\documentclass{scrbook}
\usepackage[inline]{enumitem}
\usepackage{tabulary}
\newenvironment{compactitemt}{
\begin{minipage}[t]{\hsize}\begin{itemize}[nosep, wide=0pt]
}{ \end{itemize}\end{minipage} }
\begin{document}
\begin{tabulary}{\linewidth}{| J | J |}
other column &
top line 1
\begin{compactitemt}
\item table item 1
\end{compactitemt}
bottom line 1
\\
\end{tabulary}
\end{document}
最終目標は、J
次のようにリストを含む均等間隔の列を作成することです。
上記の例では、テキストが短すぎて改行がない場合、2 番目の列の幅が内部のテキストと同じだけになるのが理想的ですが、テーブルが小さすぎて 1 行の幅よりも小さくする必要がある場合は、手動でtabularx
と列を使用することで、これに対処できると思います。l
答え1
tabulary
hmode を使用して各セルのデータ量を測定します。つまり、リストなどの垂直構造は機能しません。\[
試行中はローカルで安全になります (として機能しますが$
、他には何も機能しません)。itemixe の非常に基本的な変更は以下のようになりますが、出力はそれほど素晴らしいものではありません。私は通常の幅を使用し、手動で列tabular
の幅を選択します。p{...}
\documentclass{article}
\usepackage{tabulary}
\makeatletter
\def\TY@list#1#2{%
\renewcommand\item[1][]{ }%
}
\def\TY@tab{%
\setbox\z@\hbox\bgroup
\let\[$\let\]$%
% new bit to make itemize safe
\let\list\TY@list
\let\enditemize\relax
\let\endlist\relax
% end change
\let\equation$\let\endequation$%
\col@sep\tabcolsep
\let\d@llarbegin\begingroup\let\d@llarend\endgroup
\let\@mkpream\TY@mkpream
\def\multicolumn##1##2##3{\multispan##1\relax}%
\CT@start\TY@tabarray}
\makeatother
\begin{document}
\centering
\begin{tabulary}{\linewidth}{L L}
test &
\begin{itemize}
\item table item 1
\end{itemize}
\\
\end{tabulary}
\end{document}