I want to put whole of a text on a single page. I don't have constraint on the text font. So if the text was too long, the text font should be small. How can I do this automatically using LaTeX? For example, if I write the \lipsum, the printed document should contain exactly one page.
Asked
Active
Viewed 1,455 times
2
Mas ooD
- 187
-
Perhaps you can take a look at this. You could create a box the size of the page to fit the text in. – Gilean0709 Sep 15 '14 at 16:56
1 Answers
2
With tcolorbox:
\documentclass[11pt,a4paper]{article}%
\usepackage{lipsum}
\usepackage{tcolorbox}
\tcbuselibrary{fitting}
\tcbset{width=(\linewidth-2mm),colback=green!10!white,boxsep=1mm}
\begin{document}
\tcboxfit[height=(\textheight-2mm)]{\lipsum\lipsum}
\end{document}

Without colors:
\documentclass[11pt,a4paper]{article}%
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\tcbset{width=(\linewidth),colback=white,left=0mm,right=0mm,top=0mm,bottom=0mm,boxrule=0mm}
\begin{document}
\tcboxfit[height=(\textheight),enhanced jigsaw]{\lipsum\lipsum}
\end{document}
Environment form:
\documentclass[11pt,a4paper]{article}%
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\newtcboxfit{\mybox}[1][]{%
colback=red!5!white,
colframe=red!75!black,
width=(\linewidth),
height=(\textheight),
left=0mm,right=0mm,top=0mm,bottom=0mm,boxrule=0mm,
enhanced jigsaw,
#1}
\begin{document}
\mybox[colback=yellow]%
{\lipsum}
\mybox[colback=white]%
{\lipsum}
\mybox%
{\lipsum}
\end{document}

I have added three pages. You can put everything inside a single \mybox{...} and content will be contained in a single page.