1

I'm trying to make a table with the following characteristics:

  • Able to break across pages
  • With right alignment of second column
  • Able to adjust line spacing

I've tried longtable and multicol but I can't make these work together. I've put an example of what I mean, but this does not enable me to tighten that line spacing or right align the second column. It's not practical to break the data into separate columns, given its volume.

\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}
2
  • The easy solution is to add \hfill to each \item. Jul 23, 2023 at 13:26
  • Thanks but that doesn't solve the line separation question
    – alice19
    Jul 23, 2023 at 17:44

1 Answer 1

1

This would be easier if \labelsep were outside the label box and \leftmargin did not also position the label box.

\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}
3
  • 1
    +1. You may also want to provide the instruction \addtolength{\columnsep}{0.5in} (or something similar) in order to increase the distance between the columns by a suitable amount.
    – Mico
    Jul 23, 2023 at 14:49
  • Thanks - can I adjust the line spacing via this?
    – alice19
    Jul 23, 2023 at 17:45
  • The line spacing can be controled through \itemsep. Jul 23, 2023 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .