이 테이블을 페이지 분할 가능하게 만드는 방법은 무엇입니까?

이 테이블을 페이지 분할 가능하게 만드는 방법은 무엇입니까?

현재 조금 커져서 더 이상 의도한 공간에 맞지 않는 테이블이 있습니다. 이 테이블은 앞으로도 계속 커질 것으로 예상되므로 현재 스타일을 유지하면서 페이지 구분이 가능하도록 만들어야 합니다. 페이지 나누기 가능 테이블을 얻는 방법에 대한 많은 게시물이 있지만, 머리를 감쌀 수 없는 오류가 발생했거나 최종 출력이 보이지 않았기 때문에 내가 찾은 솔루션 중 어떤 것도 사용할 수 없었습니다. 의도 한대로.

나는 현재(깨지지 않는) 테이블과 그것이 생성하는 출력의 스크린샷을 보여주는 MWE를 아래에 공유합니다. MWE가 하는 일은 필요할 때마다 호출할 수 있는 목록 환경을 만드는 것입니다. 내 목표는이 출력을 복제하되 페이지 나누기에 도달할 때마다 테이블이 (점프하지 않고) 올바르게 중단되는지 확인합니다..

\documentclass[a4paper]{article}

\begin{document}

\newenvironment{entrylist}{%
  \noindent
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}rl}
}{%
  \end{tabular*}
}
\newcommand{\entry}[4]{%
    \parbox[t]{1.75cm}{#1\raggedleft}&\parbox[t]{\dimexpr\textwidth-2\tabcolsep-1.75cm}{\strut%
    \textbf{#2}%
    \hfill%
    {\footnotesize #3\par\strut}%
    #4\vspace{\parsep}%
  }\\}

\begin{entrylist}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {Fancy stuff 1}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {Fancy stuff 2}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {Fancy stuff 3}
    
\end{entrylist}

\end{document}

여기에 이미지 설명을 입력하세요

시간을 내주셔서 진심으로 감사드립니다.

답변1

전체 내용을 테이블 형식 환경으로 캡슐화할 필요는 없습니다. \entry매크로별로 각각의 형식을 정의할 수 있습니다 . 물론 after는 페이지를 깨뜨릴 수 있습니다 \smallskip.\hbox

\newdimen\colsep \colsep=1em
\def\topbox#1#2{\vtop{\parindent=0pt \hsize=\dimexpr#1\relax #2}}
\def\entry#1#2#3#4{\par
   \hbox{\topbox{1.75cm}{#1\raggedleft}\kern\colsep
         \topbox{\hsize-2\colsep-1.75cm}{{\bf#2}\hfill {\footnotesize#3}\endgraf#4\strut}}
   \smallskip
}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {Fancy stuff 1}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {Fancy stuff 2}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {Fancy stuff 3}

답변2

내 생각엔 네가 해야 할 일은

  • 패키지 를 로드 longtable하고 지침을 발행 \setlength\LTleft{0pt}하고 \setlength\LTright{0pt}서문에서

  • 환경 정의에서 \begin{tabular*}{\textwidth}with \begin{longtable}\end{tabular*}with로 대체합니다 .\end{longtable}entrylist

\noindent선택적으로 환경 정의 시작 시 지시문을 삭제할 수 있습니다 entrylist.

longtable길이 매개변수 \LTleft\LTright기능 에 대한 자세한 내용은 사용자 가이드 의 "조정" 섹션 5를 참조하세요 .

답변3

사용 longtable.

\documentclass[a4paper]{article}
\usepackage{longtable,array}

\usepackage{lipsum} % for nonsense text
\usepackage{showframe} % for showing the page boundaries

\newlength{\entrylistwidth}
\setlength{\entrylistwidth}{1.75cm}
\newenvironment{entrylist}{%
  \begin{longtable}{
    @{}
    w{l}{\entrylistwidth}
    p{\dimexpr\textwidth-2\tabcolsep-\entrylistwidth}
    @{}
  }
}{\end{longtable}}

\newcommand{\entry}[4]{%
  #1 & \textbf{#2}\hfill{\footnotesize #3\par}#4\\\noalign{\vspace{\parsep}}%
}

\begin{document}

\begin{entrylist}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {\lipsum[1][1-3]}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {\lipsum[2][1-3]}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
\end{entrylist}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보