長いテーブルと複数行に関するさらなる問題

長いテーブルと複数行に関するさらなる問題

前回の質問では、当面の問題を解決する回避策がいくつかありました。しかし、この 2 つのパッケージはうまく連携しないような気がします。列を 1 つ追加し、異なる行セットに複数の行を配置すると、回避策が機能しなくなります。

コードは次のとおりです:

\documentclass{article}

\usepackage{longtable}
\usepackage {multirow}
\usepackage{lipsum}

\begin{document}

\begin{center}
\begin{longtable}{p{.15\textwidth} p{.15\textwidth} p{0.32\textwidth} p{0.32\textwidth}}
\hline 
1 & 1.1 & \multirow{2}{.32\textwidth} {\lipsum[1] } & some text \\ \cline{4-4}
 & 1.2 & & \multirow{2}{.32\textwidth}{\lipsum[2]} \\ \cline{2-3}  
& 1.3 & some other text  & \\ \hline
 2 & 2.1 & some more text & \lipsum[3] \\ \hline 
 \end{longtable}
\end{center}

\end{document}

そして、結果は明らかに良くありません。この問題の一般的な解決策を見つけるためのご助力は大歓迎です。

前のコードの出力

答え1

前回の(ほぼ同じ)質問に対する回答で問題は解決します。そうでない場合、質問が明確ではありません。

@sveinungの採用答え:

\documentclass{article}
\usepackage{makecell, longtable}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
    \begin{longtable}{|p{\dimexpr0.07\textwidth-2\tabcolsep-1.25\arrayrulewidth}
                      |p{\dimexpr0.07\textwidth-2\tabcolsep-1.25\arrayrulewidth}
                      |p{\dimexpr0.43\textwidth-2\tabcolsep-1.25\arrayrulewidth}
                      |p{\dimexpr0.43\textwidth-2\tabcolsep-1.25\arrayrulewidth}
                      |}
    \hline
1   & 1.1   & \lipsum[1]        & some text     \\ \cline{2-4}
    & 1.2   &                   & \lipsum[2]    \\ \cline{2-4}
    & 1.3   & some other text   &               \\ 
    \hline
2   & 2.1   & some more text    & \lipsum[3]    \\ 
    \hline
    \end{longtable}
\end{document}

注記: \multirow[<number of rows>{...}{cell's contents}高さは行数(含まれる行数)によって決まるわけではありません。隣接する列の指定された行数にまたがります。それらの高さがセルの高さよりも小さい場合、multirow質問で観察されているように、その内容は隣接するセルに溢れてしまいます。

@ebcontrol がコメントで提案しているように、パッケージのドキュメントを読んでください。

編集:列の幅が修正され、 の幅はlongtableちょうど になりました\textwidth

答え2

注意例2のコードを更新しました

例が読みやすくなるよう、ダミーのテキストを短くしています。添付の​​ 2 つの例を見て、それがあなたが達成しようとしていることとどう違うのか教えてください。特に、例 2 では手作業が必要です。

例1

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{longtable, booktabs, array}
\usepackage{lipsum}

\newcolumntype{O}{p{\dimexpr(0.15\linewidth-1.5\tabcolsep)}}
\newcolumntype{Q}{p{\dimexpr(0.35\linewidth-1.5\tabcolsep)}}


%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\newcommand{\mytexti}{This is a dummy text, however I have an issue using multirow and longtable. The content in the multirow cell is very large, and it goes well beyond the limit of the "non-multirowed" rows. LaTeX ignores that and starts the following row just behind those rows, therefore overwriting the content.}

\newcommand{\mytextii}{This is a shorter dummy text, LaTeX ignores me!}

\begin{document}

\begin{longtable}{@{}OOQQ@{}}
   \toprule\addlinespace[1ex]
1 & 1.1 & \mytexti         & some text \\ \cmidrule{4-4}
  & 1.2 &                  & \mytextii \\ \cmidrule{3-3}  
  & 1.3 & some other text  &           \\ \bottomrule \addlinespace[1ex]
2 & 2.1 & some more text   & \mytexti  \\ \bottomrule 
\end{longtable} 

\end{document}

例2

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{longtable, booktabs, array, multirow, bigstrut}
\usepackage{lipsum}

    \newcolumntype{O}{p{\dimexpr(0.15\linewidth-1.5\tabcolsep)}}
    \newcolumntype{Q}{p{\dimexpr(0.35\linewidth-1.5\tabcolsep)}}


%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\newcommand{\mytexti}{This is a dummy text, however I have an issue using multirow and longtable. The content in the multirow cell is very large, and it goes well beyond the limit of the "non-multirowed" rows. LaTeX ignores that and starts the following row just behind those rows, therefore overwriting the content.}

\newcommand{\mytextii}{This is a shorter dummy text, LaTeX ignores me!}


\begin{document}

\begin{longtable}{@{}OOQQ@{}}
   \toprule\addlinespace[1ex]
1   &                                   & \mytexti          & some text\strut   \hrule  \\ 
    & \multirow[t]{-14}{=}{1.1\\ 1.2}   & some other text   & \multirow[t]{-12.9}{=}{\mytextii}     \\ \cmidrule{3-3}
    & 1.3   & some other text   &                                                               \\
\bottomrule \addlinespace[1ex]  
 2  & 2.1   & some more text    & \mytexti                                                      \\ \bottomrule 

 \end{longtable} 

\end{document}

関連情報