TeX - LaTeX Asked by jens on January 29, 2021
I wish to insert long itemized lists inside a longtable
.
While itemize environments normally insert pagebreaks at adequate positions, they behave as if they were unbreakable when wrapped inside a longtable. How can I influence this behavior?
documentclass[a4paper]{article}
usepackage{blindtext}
usepackage{longtable}
begin{document}
begin{longtable}{|p{10cm}|}
begin{itemize}
item blindtext
item blindtext
item blindtext
%pagebreak
item blindtext
end{itemize}
end{longtable}
end{document}
When compiling the above, the first page stays empty while the longtable
starts on the second page. The entire itemize
environment gets stuffed into a single page that overflows at the bottom.
I would like pagebreaks to be inserted anywhere: preferrably between two consecutive item
elements (or if an item
is too long, it may be broken up). Even inserting a manual pagebreak
(as hinted) will just widen the vertical space between the adjacent item
entries without producing the expected behavior.
I read elsewhere that this might have to do with some penalty values, but I couldn’t quite figure out how to set them.
EDIT:
The above is an MWE. The real document is a report with very long lists of publications. I use a tabular structure because I need to reproduce an official Word template that has everything in tables. Occasionally I need to use double columns, split cells etc., to reproduce the template, so I really need some longtable
type package.
A solution involving other tricks and packages is welcome. I hope you see what I want to achieve.
The real thing is a little more like this:
documentclass[a4paper]{article}
usepackage{longtable}
usepackage{enumitem}
usepackage{hyperref}
begin{document}
begin{longtable}{|p{linewidth}|}
hline
textbf{A1. List all scientific publications} hline
Authors, titles, references, etc. hline
setlength{parindent}{1em}
textbf{Journal papers}
begin{enumerate}[start=1,label={[Jarabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
% many many more items here
end{enumerate}
setlength{parindent}{1em}
textbf{Patents}
begin{enumerate}[start=1,label={[Parabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
% many many more items here
end{enumerate}
setlength{parindent}{1em}
textbf{Open source code}
begin{enumerate}[start=1,label={[Oarabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors: textit{Title} url{https://example.com/software}.
item Authors: textit{Title} url{https://example.com/software}.
item Authors: textit{Title} url{https://example.com/software}.
% many many more items here
end{enumerate}
hline
end{longtable}
end{document}
For your purpose you not need longtable
. Use just lists which can break between pages. hline
you can mimic with noindentrule{linewidth}{0.5pt}
:
documentclass[a4paper]{article}
usepackage{enumitem}
usepackage{hyperref}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
noindentrule{linewidth}{0.5pt}
textbf{A1. List all scientific publications}
Authors, titles, references, etc.
noindentrule{linewidth}{0.5pt}
textbf{Journal papers}
begin{enumerate}[start=1,label={[Jarabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
item Authors, ``Title,'' Journal, vol. 00, pp. 1234-4321, 2020.
% many many more items here
end{enumerate}
textbf{Patents}
begin{enumerate}[start=1,label={[Parabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
item Authors. Title. Code. Publication number: 123456.
end{enumerate}
textbf{Open source code}
begin{enumerate}[start=1,label={[Oarabic*]},leftmargin=10mm,rightmargin=5mm]
item Authors: textit{Title} url{https://example.com/software}.
item Authors: textit{Title} url{https://example.com/software}.
item Authors: textit{Title} url{https://example.com/software}.
% many many more items here
end{enumerate}
noindentrule{linewidth}{0.5pt}
end{document}
Answered by Zarko on January 29, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP