长表格跨越多页,具有右对齐和多列

长表格跨越多页,具有右对齐和多列

我正在尝试制作具有以下特征的表格:

  • 能够跨页分页
  • 第二列右对齐
  • 能够调整行距

我尝试过 longtable 和 multicol,但无法让它们协同工作。我举了一个例子来说明我的意思,但这并不能让我缩小行距或右对齐第二列。考虑到数据量,将数据分成单独的列是不切实际的。

\documentclass[a4paper]{article}

\usepackage{scrextend}
\usepackage{multicol}

\begin{document}

\begin{multicols}{3}
\begin{labeling}{0000} 
\item [5058] KS0-08 
\item [5067] K50-50 
\item [5085] K7T-T5 
\item [509S] KT7-50 
\item [XS04] KSS-S6 
\item [XS04] K7-57 
\item [XSU5] K4S-64 
\item [XSU7] KT4-S8 
\item [XSU8] KT4-50 
\item [XS68] KSS-84 
\item [XS8S] K8-79 
\item [XS9S] KT5-50 
\item [XS9U] KS6-45 
\item [XT0S] KS0-50 
\item [XT08] KST4-76 
\item [XTSU] K45-45 
\item [XTS5] K47-50 
\item [XTS6] K90-50 
\item [XTS7] K60-50 
\item [XTT0] K40-50 
\item [XTTU] K40-50 
\item [XTT4] KSTT-50 
\item [XTT5] K67-TS 
\item [XTT6] KT5-50 
\item [XTT7] K9-06 
\item [XTT8] K56-50 
\item [XTT9] K94-50 
\item [XTU0] KS69-T8 
\item [XTUS] KU8U-S0 
\item [XTUT] K7U-80 
\item [XTUU] KST0-66 
\item [XTU4] K457-U5 
\item [XTU5] K79-4U 
\item [XTU6] KT4-50 
\item [XTU7] K45-50 
\item [XTU8] KS04-T6 
\item [XTU9] KT50-90 
\item [XT40] KUT-99 
\item [XT4S] KS9S-T0 
\item [XT4T] KS79-T5 
\item [XT4U] KU06-TT 
\item [XT44] KUS-0T 
\item [XT45] KU5-50 
\item [XT46] KTT-4S 
\item [XT47] KT5-86 
\item [XT48] KT04-50 
\item [XT49] K50-50 
\item [XT50] K60-5T 
\item [XT5S] KT50-50 
\item [XT5T] K9T-45 
\item [XT5U] K50-50 
\item [XT54] KTT-50 
\item [XT50] KS6-50 
\item [XT56] KSU9-S9 
\item [XT57] K50-50 
\item [XT58] K70-50 
\item [XT59] K80-50 
\item [XT6S] K45-04 
\item [XT6T] K7U-UT 
\item [XT6U] K9S-66 
\item [XT64] KS46-64 
\item [XT65] KU4-9T 
\item [XT66] KU9-97 
\item [XT67] K7S-U0 
\item [XT68] K96-50 
\item [XT69] KT5-50     
\item [XT70] KU0-50 
\item [XT7S] K90-50 
\item [XT7T] K70-50 
\item [XT7U] K70-50 
\item [XT74] KST0-50
\item [XT75]     KT90-50
\item [XT76] KT5-50 
\item [XT77]     KSU-49 
\item [XT78] K4T-75 
\item [XT79] K95-50
\item [XT80] KS95-50
\item [XT8S] K50-50
\item [XT8T]     KS85-50
\item [XT8U] KU0-50
\item [XT84] KUT-UU
\item [XT85] KS50-50
\item [XT86] KU5-50
\item [XT87] K77-50 
\item [XT88] K56-50
\item [XT89] K90-50
\item [XT90] K50-50
\item [XT9S] K50-50
\item [XT9T] KS99-89
\item [XT9U] KT70-50
\item [XT94] KTS-75
\item [XT95] KTS-75
\item [XT96] KU5-50
\item [XT97] K45-50
\item [XT98] K50-50
\item [XU50] K50-50
\item [XU0S] KU0-50
\item [XU0T] K85-50
\item [XU0U] K65-50
\item [XU04] KUS-0S
\item [XU05] K99-T0
\item [XU06] K50-80
\item [XU07] K49-60
\item [XU08] K4U-40
\item [XU09] KUS-50
\item [XUS0] KUS-50
\item [XUSS] K68-T0
\item [XUST] KT4-80
\item [XUSU] K45-50
\item [XUS4] K50-50
\item [XUS5] KST0-50
\item [XUS6] KT0-50
\item [XUS7] K40-50 
\item [XUS8] KS7U-60
\item [XU44] KS0-UU
\item [XU45] KS0-UU
\item [XU47] KS0-UU  
\item [XU49] K68-T0
\item [XU50] KS48-80
\item [XU5S] K74-40
\item [XU5T] KU7-T0
\item [XU5U] KU7-T0
\end{labeling}
\end{multicols}


\end{document}

答案1

\labelsep如果位于标签框外面并且\leftmargin没有定位标签框,这会更容易。

\documentclass[a4paper]{article}

\usepackage{scrextend}
\usepackage{multicol}
\usepackage{showframe}

\makeatletter
\renewenvironment{labeling}[2][]{%
  \def\sc@septext{#1}%
  \list{}{\settowidth{\labelwidth}{{%
        \usekomafont{labelinglabel}{#2%
          \usekomafont{labelingseparator}{\sc@septext}}%
      }}%
    \leftmargin\labelwidth \advance\leftmargin by \labelsep
    \let\makelabel\labelinglabel
    \let\normal@item=\@item% added
    \renewcommand{\@item}[1][]{\normal@item[##1]\hfill}% added
  }%
}{%
  \endlist
}
\makeatother

\begin{document}

\begin{multicols}{3}
\begin{labeling}{0000} 
\item [5058] KS0-08
\item [5067] K50-50 
\item [5085] K7T-T5 
\item [509S] KT7-50 
\item [XS04] KSS-S6 
\item [XS04] K7-57 
\item [XSU5] K4S-64 
\item [XSU7] KT4-S8 
\item [XSU8] KT4-50 
\item [XS68] KSS-84 
\item [XS8S] K8-79 
\item [XS9S] KT5-50 
\item [XS9U] KS6-45 
\item [XT0S] KS0-50 
\item [XT08] KST4-76 
\item [XTSU] K45-45 
\item [XTS5] K47-50 
\item [XTS6] K90-50 
\item [XTS7] K60-50 
\item [XTT0] K40-50 
\item [XTTU] K40-50 
\item [XTT4] KSTT-50 
\item [XTT5] K67-TS 
\item [XTT6] KT5-50 
\item [XTT7] K9-06 
\item [XTT8] K56-50 
\item [XTT9] K94-50 
\item [XTU0] KS69-T8 
\item [XTUS] KU8U-S0 
\item [XTUT] K7U-80 
\item [XTUU] KST0-66 
\item [XTU4] K457-U5 
\item [XTU5] K79-4U 
\item [XTU6] KT4-50 
\item [XTU7] K45-50 
\item [XTU8] KS04-T6 
\item [XTU9] KT50-90 
\item [XT40] KUT-99 
\item [XT4S] KS9S-T0 
\item [XT4T] KS79-T5 
\item [XT4U] KU06-TT 
\item [XT44] KUS-0T 
\item [XT45] KU5-50 
\item [XT46] KTT-4S 
\item [XT47] KT5-86 
\item [XT48] KT04-50 
\item [XT49] K50-50 
\item [XT50] K60-5T 
\item [XT5S] KT50-50 
\item [XT5T] K9T-45 
\item [XT5U] K50-50 
\item [XT54] KTT-50 
\item [XT50] KS6-50 
\item [XT56] KSU9-S9 
\item [XT57] K50-50 
\item [XT58] K70-50 
\item [XT59] K80-50 
\item [XT6S] K45-04 
\item [XT6T] K7U-UT 
\item [XT6U] K9S-66 
\item [XT64] KS46-64 
\item [XT65] KU4-9T 
\item [XT66] KU9-97 
\item [XT67] K7S-U0 
\item [XT68] K96-50 
\item [XT69] KT5-50     
\item [XT70] KU0-50 
\item [XT7S] K90-50 
\item [XT7T] K70-50 
\item [XT7U] K70-50 
\item [XT74] KST0-50
\item [XT75]     KT90-50
\item [XT76] KT5-50 
\item [XT77]     KSU-49 
\item [XT78] K4T-75 
\item [XT79] K95-50
\item [XT80] KS95-50
\item [XT8S] K50-50
\item [XT8T]     KS85-50
\item [XT8U] KU0-50
\item [XT84] KUT-UU
\item [XT85] KS50-50
\item [XT86] KU5-50
\item [XT87] K77-50 
\item [XT88] K56-50
\item [XT89] K90-50
\item [XT90] K50-50
\item [XT9S] K50-50
\item [XT9T] KS99-89
\item [XT9U] KT70-50
\item [XT94] KTS-75
\item [XT95] KTS-75
\item [XT96] KU5-50
\item [XT97] K45-50
\item [XT98] K50-50
\item [XU50] K50-50
\item [XU0S] KU0-50
\item [XU0T] K85-50
\item [XU0U] K65-50
\item [XU04] KUS-0S
\item [XU05] K99-T0
\item [XU06] K50-80
\item [XU07] K49-60
\item [XU08] K4U-40
\item [XU09] KUS-50
\item [XUS0] KUS-50
\item [XUSS] K68-T0
\item [XUST] KT4-80
\item [XUSU] K45-50
\item [XUS4] K50-50
\item [XUS5] KST0-50
\item [XUS6] KT0-50
\item [XUS7] K40-50 
\item [XUS8] KS7U-60
\item [XU44] KS0-UU
\item [XU45] KS0-UU
\item [XU47] KS0-UU  
\item [XU49] K68-T0
\item [XU50] KS48-80
\item [XU5S] K74-40
\item [XU5T] KU7-T0
\item [XU5U] KU7-T0
\end{labeling}
\end{multicols}


\end{document}

相关内容