TeX - LaTeX Asked on January 28, 2021
I would like to disable the command newpage
.
I did the following but it does not work.
documentclass{article}
renewcommand{newpage}{}
begin{document}
begin{itemize}
item A
item B
newpage
item C
end{itemize}
end{document}
Thank you for your help.
I suggest you include the following code in the preamble:
usepackage{etoolbox}
AtBeginDocument{%
letorignewpagenewpage
renewcommandnewpage{}
patchcmd{clearpage}{newpage}{orignewpage}{}{}}
That way, the code chunk
begin{itemize}
item A
item B
newpage
item C
end{itemize}
is assured not to generate a page break between items B and C.
Observe that it's very necessary to patch clearpage
, since clearpage
contains a newpage
directive internally and because clearpage
is used by quite a few LaTeX macros, including the enddocument
macro that's run when end{document}
is encountered. For more on the subject of newpage
vs. clearpage
, see the posting Is it wrong to use clearpage instead of newpage? (shameless self-citation alert!)
(If other LaTeX macros contain a newpage
directive internally, those macros would need to be patched as well. One such macro, which is defined by the LaTeX kernel, is cleardoublepage
. Fortunately (?) for you, cleardoublepage
doesn't get used by the article
document class unless the options twoside
and openright
are both set.)
Correct answer by Mico on January 28, 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