縦向きの(反対側の)A4 ページ 2 枚の幅にまたがる表を作成するにはどうすればよいですか?

縦向きの(反対側の)A4 ページ 2 枚の幅にまたがる表を作成するにはどうすればよいですか?

大きな (幅の広い) 表をタイプセットする必要があります。私は通常、表の各列の幅を指定できる以下のコードを表に使用します。ただし、列幅の合計がページに収まるようにするのは私の責任です。

\documentclass[12pt, a4paper]{article} 
\usepackage{booktabs, array}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}
\begin{table}
\begin{tabular}{C{2cm}  C{2cm} C{2cm} C{2cm}  C{2cm} C{2cm}}
\toprule

~ & \textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} & \textbf{Column 4} & \textbf{Column 5}  \\
\textbf{Row 1} & Text (1,1) & Text (1,2) & Text (1,3) & Text (1,4) & Text (1,5)  \\
\textbf{Row 2} & Text (2,1) & Text (2,2) & Text (2,3) & Text (2,4) & Text (2,5)  \\
\textbf{Row 3} & Text (3,1) & Text (3,2) & Text (3,3) & Text (3,4) & Text (3,5)  \\
\textbf{Row 4} & Text (4,1) & Text (4,2) & Text (4,3) & Text (4,4) & Text (4,5)  \\
\textbf{Row 5} & Text (5,1) & Text (5,2) & Text (5,3) & Text (5,4) & Text (5,5)  \\
\textbf{Row 6} & Text (6,1) & Text (6,2) & Text (6,3) & Text (6,4) & Text (6,5)  \\

 \bottomrule

\end{tabular}
\caption{This is a table}
\end{table}
\end{document}

A4縦2ページ分の幅に渡る非常に幅の広い表を作成したい

(私はページの両面を使用して文書を作成しており、表の左隅を偶数ページ番号に、表の右隅を反対ページに配置したいと考えています)。

したがって、表が 2 ページの A4 ページの幅にわたって連続するように、左ページに右余白はなく、右ページにも左余白はありません。

これは可能ですか?

答え1

私は答えを次のように始めました各ページに 3 つのテキストがあり、段落ごとに整列した 6 つの並列テキストを作成するにはどうすればよいですか?ベースラインとして使用しましたが、いくつかの変更を加える必要がありました。

簡単なのは、この OP のクエリで異なる高さの行エントリについて心配する必要がないことです。しかし、悪い点は、10 以上の列エントリを処理するためにコードを大幅に書き直す必要があることです (#10動作しないため)。そのために、異なる列エントリを引数として渡すのではなく、独自のタブ解析コードを作成して、行を表形式の行であるかのように入力できるようにしました。

内の表形式トークンを処理するために、Herbert のコード スニペットを引き続き使用し\whiledo、モードのときに偶数ページ番号で表を開始するための Stephan Lehmke のスニペットを追加しましたtwoside

ボーナス機能として、コードを左/右ページに分割できるだけでなく、非常に長いテーブルの場合は垂直方向にも分割できます。構文は\newtwopagetableプロセスを初期化することです。次に、\tenbyrow{}引数が&10 個のエントリの で区切られたリストである個々の行が追加されます (他の列番号エントリの場合は、少し書き直します)。最後に、すべてのデータがこの方法で入力されると、次の 2 つのオプションがあります。

\newtwopagetable{caption}

表全体を2ページにわたって出力します。

\maketwopagetable[4]{caption}
\maketwopagetable[4]{caption}

は、両面の表を垂直方向に分割し、上記のように最初の見開きページに 4 行、2 番目の見開きページに 4 行を表示します。

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

\documentclass[twoside]{article}% TABLE CLEARS TO EVEN PAGE
%\documentclass{article}% TABLE CLEARS TO NEXT PAGE
\usepackage{booktabs, array}
\usepackage{ifthen}
\usepackage{etoolbox}

\makeatletter%%%%%%%%%%% My own tab parsing code

\newcounter{TABcellindex@}

\newcommand\readTABrow[2]{%
  \def\doneTABread{F}%
  \def\postTAB{#2}%
  \setcounter{TABcellindex@}{0}%
  \whiledo{\equal{\doneTABread}{F}}{%
    \stepcounter{TABcellindex@}%
    \expandafter\processTAB\postTAB&\\%
    \ifthenelse{\equal{\preTAB}{}}{%
      \addtocounter{TABcellindex@}{-1}%
      \def\doneTABread{T}%
    }{%
      \expandafter\protected@edef\csname #1\alph{TABcellindex@}\endcsname{%
        \preTAB}%
    }%
  }%
% \#1TABcells GIVES HOW MANY TAB COLUMNS WERE PROCESSED
%  \expandafter\xdef\csname #1TABcells\endcsname{\arabic{TABcellindex@}}%
}

\def\processTAB#1&#2\\{%
  \protected@edef\preTAB{#1}%
  \protected@edef\postTAB{#2}%
}

\makeatother%%%%%%%%%%% END My own tab parsing code

\makeatletter%%%%%%%%%%% Herbert's tabular token code
\newcounter{tabindex}
\newtoks\@tabtoks
\newcommand\addtabtoks[1]{%
  \@tabtoks\expandafter{\the\@tabtoks\stepcounter{tabindex}#1}}
\newcommand*\resettabtoks{\@tabtoks{}}
\newcommand*\synctabindex[1]{\setcounter{tabindex}{\value{#1}}}
\newcommand*\printtabtoks{\the\@tabtoks}
\makeatother%%%%%%%%%%% END Herbert's tabular token code

\makeatletter%%%%%%% Lehmke's \cleartoleftpage
\def\cleartoleftpage{\clearpage\if@twoside \ifodd\c@page
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
\makeatother%%%%%%%% END Lehmke's \cleartoleftpage


\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newcounter{sptstartrow}
\newcounter{sptendrow}
\newcounter{entries}

\newcommand\newtwopagetable{%
  \setcounter{sptendrow}{0}%
  \setcounter{entries}{0}%
  \cleartoleftpage%
}

\makeatletter
\newcommand\tenbyrow[1]{%
  \stepcounter{entries}%
  \readTABrow{entryX\roman{entries}X}{#1}%
}
\makeatother
\newcounter{index}
\newcommand\maketwopagetable[2][\theentries]{%
  \setcounter{sptstartrow}{\thesptendrow}%
  \ifthenelse{\thesptstartrow > 1}%
    {\addtocounter{table}{-1}\def\conttext{, continued}}%
    {\def\conttext{}}%
  \addtocounter{sptendrow}{#1}%
  \ifthenelse{\thesptendrow > \theentries}{\setcounter{sptendrow}{\theentries}}{}%
  \clearpage
  \setcounter{index}{\thesptstartrow}%
  \synctabindex{index}
  \resettabtoks%
  \whiledo{\theindex < \thesptendrow}{%
    \stepcounter{index}%
    \addtabtoks{%
      \csname entryX\roman{tabindex}Xa\endcsname &
      \csname entryX\roman{tabindex}Xb\endcsname &
      \csname entryX\roman{tabindex}Xc\endcsname & 
      \csname entryX\roman{tabindex}Xd\endcsname &
      \csname entryX\roman{tabindex}Xe\endcsname 
      \\%
    }%
  }%
  \begin{table}
  \centering
  \begin{tabular}{C{2cm}  C{2cm} C{2cm} C{2cm} C{2cm}}
   \toprule

   \printtabtoks%

   \bottomrule
  \end{tabular}%
  \caption{#2 (left half\conttext)}
  \end{table}%
  \addtocounter{table}{-1}%
  \clearpage
  \setcounter{index}{\thesptstartrow}%
  \synctabindex{index}
  \resettabtoks%
  \whiledo{\theindex < \thesptendrow}{%
    \stepcounter{index}%
    \addtabtoks{%
      \csname entryX\roman{tabindex}Xf\endcsname &
      \csname entryX\roman{tabindex}Xg\endcsname &
      \csname entryX\roman{tabindex}Xh\endcsname &
      \csname entryX\roman{tabindex}Xi\endcsname &
      \csname entryX\roman{tabindex}Xj\endcsname 
      \\%
    }%
  }%
  \begin{table}
  \centering
  \begin{tabular}{C{2cm}  C{2cm} C{2cm} C{2cm} C{2cm}}
   \toprule

   \printtabtoks%

   \bottomrule
  \end{tabular}%
  \caption{#2 (right half\conttext)}
  \end{table}%
}

\begin{document}
\newtwopagetable
\tenbyrow%
{~ & \textbf{Column 1} & \textbf{Column 2} & \textbf{Column 3} &
\textbf{Column 4} & \textbf{Column 5} & \textbf{Column 6} &
\textbf{Column 7} & \textbf{Column 8} & \textbf{Column 9}}
\tenbyrow%
{\textbf{Row 1} & Text (1,1) & Text (1,2) & Text (1,3) & Text (1,4)
& Text (1,5) & Text (1,6) & Text (1,7) & Text (1,8) & Text (1,9)}
\tenbyrow%
{\textbf{Row 2} & Text (2,1) & Text (2,2) & Text (2,3) & Text (2,4)
& Text (2,5) & Text (2,6) & Text (2,7) & Text (2,8) & Text (2,9)}
\tenbyrow%
{\textbf{Row 3} & Text (3,1) & Text (3,2) & Text (3,3) & Text (3,4)
& Text (3,5) & Text (3,6) & Text (3,7) & Text (3,8) & Text (3,9)}
\tenbyrow%
{\textbf{Row 4} & Text (4,1) & Text (4,2) & Text (4,3) & Text (4,4)
& Text (4,5) & Text (4,6) & Text (4,7) & Text (4,8) & Text (4,9)}
\tenbyrow%
{\textbf{Row 5} & Text (5,1) & Text (5,2) & Text (5,3) & Text (5,4)
& Text (5,5) & Text (5,6) & Text (5,7) & Text (5,8) & Text (5,9)}
\tenbyrow%
{\textbf{Row 6} & Text (6,1) & Text (6,2) & Text (6,3) & Text (6,4)
& Text (6,5) & Text (6,6) & Text (6,7) & Text (6,8) & Text (6,9)}
\tenbyrow%
{\textbf{Row 7} & Text (7,1) & Text (7,2) & Text (7,3) & Text (7,4)
& Text (7,5) & Text (7,6) & Text (7,7) & Text (7,8) & Text (7,9)}
\maketwopagetable{This is a table}

\newtwopagetable
\setcounter{entries}{8}% THIS IS TO FOOL LaTeX INTO THINKING I RE-ENTERED THE TABLE DATA
\maketwopagetable[4]{This is a vertically split table}
\maketwopagetable[4]{This is a vertically split table}

\end{document}

以下に、2 ページにわたる完全な表の出力を示します。

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

ここでは、表を幅と長さに分割し、次の 4 ページに出力します。(left/right half, continued)コメントは によって提供されており\maketwopagetable、ユーザーのキャプション引数の一部ではないことに注意してください。

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

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

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

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

関連情報