Code: Select all
\let\stdsection\section
\renewcommand\section{\newpage\stdsection}

Thanks!
Code: Select all
\let\stdsection\section
\renewcommand\section{\newpage\stdsection}
NEW: TikZ book now 40% off at Amazon.com for a short time.
I think I understood that:Johannes_B wrote:First, with let you copy the definition of section to stdsection. Later, section is redefined to use a newpage, and later use the original definition of section, that is stored in stdsection.
Code: Select all
\let\jinglebells\section
\renewcommand\section{\newpage\jinglebells}
I went to these websites to read about books vs reports vs articles. It didn't seem like there was THAT big of a difference... or am I missing something?Johannes_B wrote: On a sidenote, if you want that every section starts on a new page, it is more likely that you want to have a document class like report or book. Articles for shorter stuff, reports for longer reports; well, and books for books
Yes, it would. We got two lines for two reasons:LaTexLearner wrote:and it would have had the same effect?
\renewcommand\section{\newpage\section}
could replace in itself endlessly, or until memory is gone.\let\section\stdsection
after such a hack. \stdsection
was just a new macro name we introduced for this purpose. We could have chosen any name.They have a similar base. But the layout of articles is different to books/reports: the main difference is the support for chapters, wich has some consequences. Unlike sections, chapters have special headings, alway have a page break before, start by default on right hand pages, counters are usually reset per chapter, floating figures stay in their chapter etc.LaTexLearner wrote:about books vs reports vs articles. It didn't seem like there was THAT big of a difference... or am I missing something?
LaTexLearner wrote:In other words I could also have written:
and it would have had the same effect?Code: Select all
\let\jinglebells\section \renewcommand\section{\newpage\jinglebells}
\jinglebells
, in which the current definition of section is copied. Later, section is redefined, issuing a newpage and the very original definition that was copied into jinglebells.Code: Select all
\let\jinglebells\begin{tabularx}
\renewcommand\begin{tabularx}{noindent\begin{\jinglebells}}
Code: Select all
\documentclass{article}
\usepackage{showframe}
\usepackage{tabularx}
\let\jellyfish\tabularx
\renewcommand{\tabularx}{\noindent\jellyfish}
\begin{document}
\begin{tabularx}{\linewidth}{X}
\hrule
\end{tabularx}
\end{document}
Code: Select all
\documentclass{article}
\usepackage{showframe}
\usepackage{tabularx}
\usepackage{etoolbox}
%\tracingpatches
\pretocmd{\tabularx}{\noindent}{}{}
\begin{document}
\begin{tabularx}{\linewidth}{X}
\hrule
\end{tabularx}
\end{document}
What makes this way better? The extra package seems to make it more complicated to me.Johannes_B wrote:
...
But better in any way: Use modern tools instead of quick hacks.Code: Select all
\documentclass{article} \usepackage{showframe} \usepackage{tabularx} \usepackage{etoolbox} %\tracingpatches \pretocmd{\tabularx}{\noindent}{}{} \begin{document} \begin{tabularx}{\linewidth}{X} \hrule \end{tabularx} \end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.