Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Does anybody know of a documentclass that produces a page that has a fixed width and a variable length, depending on the actual content that needs to fit on the sheet? I'm trying to get something like a kind of scroll if possible.

share|improve this question
45  
\documentclass[perforation holes=false]{toiletpaper} :P –  percusse Jul 22 '12 at 15:49
4  
Welcome to TeX.SE, please provide MWE. –  Please don't touch Jul 22 '12 at 15:54
2  
@HiggsBoson: see percusse's comment, that's the MWE! :) –  Count Zero Jul 22 '12 at 16:01
2  
2  

3 Answers 3

\documentclass{minimal}
\usepackage{lipsum}
\makeatletter
\newbox\p@ge
\newenvironment{page}{\setbox\p@ge\hbox\bgroup}%
  {\egroup\setbox\p@ge\hbox{\raise\dp\p@ge\box\p@ge}\pdfpagewidth\wd\p@ge%
  \pdfpageheight\ht\p@ge\shipout\box\p@ge}
\makeatother
\AtBeginDocument{\pdfhorigin 00pt\pdfvorigin 0pt}
\begin{document}
 \begin{page}
  \begin{minipage}{5cm} 
    \lipsum[1-40]
  \end{minipage}
 \end{page}
\end{document}

I use that kind of trick to get a page as small or as big as I want, depending of the content. Hope this help !

You need to put your text in a minipage environment for usual vertical typesetting...

share|improve this answer

If you want do it in ConTeXt, you can use the TeXpage mechanism:

\starttext
  \startTEXpage [offset=2cm, width=21cm]
    \dorecurse{100}{%
      \input knuth}
  \stopTEXpage
\stoptext

But the TeX limit also applies here. With particular PDF readers you will have problems displaying such long files, even if they generate without TeX errors.

share|improve this answer

You can put your whole content in a box of a given width. Then, retrieve the height of that box and use that dimension to fix the length of the pdf page. Finally, output the stored box to that page.

The following is a MWE:

\documentclass{article}
\begin{document}
\setbox0=\vbox{
\parbox{6cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vehicula lacinia convallis. Aliquam sapien nisi, vehicula ut posuere tristique, rutrum sit amet mi. Pellentesque quis quam quis purus malesuada dapibus. Proin eget sollicitudin erat. Nunc ut ante libero. Pellentesque massa risus, bibendum consequat tincidunt eu, rhoncus sit amet ligula. Proin pharetra bibendum urna, vitae tristique dolor auctor in. Curabitur turpis felis, fringilla quis vehicula et, elementum vitae tellus. Mauris non turpis lacus. Pellentesque lorem lacus, iaculis nec egestas vitae, varius eget risus. Nullam feugiat, justo vitae pretium eleifend, eros magna euismod ante, sit amet lacinia massa ligula vel nibh. Praesent dignissim, metus ut commodo tincidunt, odio risus consequat felis, sagittis sollicitudin dolor urna et magna. Phasellus ipsum dolor, interdum eget feugiat non, lacinia nec ligula. Duis commodo aliquam vulputate. Vestibulum tempus eleifend dui, sit amet suscipit tortor pharetra eu. Sed convallis ornare nulla cursus adipiscing. Nulla quis lectus eget arcu ornare sollicitudin. Quisque faucibus posuere lacus, et dapibus mauris iaculis sed. Aenean tellus nisi, sodales vitae dignissim accumsan, semper et lacus}

\parbox{6cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vehicula lacinia convallis. Aliquam sapien nisi, vehicula ut posuere tristique, rutrum sit amet mi. Pellentesque quis quam quis purus malesuada dapibus. Proin eget sollicitudin erat. Nunc ut ante libero. Pellentesque massa risus, bibendum consequat tincidunt eu, rhoncus sit amet ligula. Proin pharetra bibendum urna, vitae tristique dolor auctor in. Curabitur turpis felis, fringilla quis vehicula et, elementum vitae tellus. Mauris non turpis lacus. Pellentesque lorem lacus, iaculis nec egestas vitae, varius eget risus. Nullam feugiat, justo vitae pretium eleifend, eros magna euismod ante, sit amet lacinia massa ligula vel nibh. Praesent dignissim, metus ut commodo tincidunt, odio risus consequat felis, sagittis sollicitudin dolor urna et magna. Phasellus ipsum dolor, interdum eget feugiat non, lacinia nec ligula. Duis commodo aliquam vulputate. Vestibulum tempus eleifend dui, sit amet suscipit tortor pharetra eu. Sed convallis ornare nulla cursus adipiscing. Nulla quis lectus eget arcu ornare sollicitudin. Quisque faucibus posuere lacus, et dapibus mauris iaculis sed. Aenean tellus nisi, sodales vitae dignissim accumsan, semper et lacus}

\parbox{6cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vehicula lacinia convallis. Aliquam sapien nisi, vehicula ut posuere tristique, rutrum sit amet mi. Pellentesque quis quam quis purus malesuada dapibus. Proin eget sollicitudin erat. Nunc ut ante libero. Pellentesque massa risus, bibendum consequat tincidunt eu, rhoncus sit amet ligula. Proin pharetra bibendum urna, vitae tristique dolor auctor in. Curabitur turpis felis, fringilla quis vehicula et, elementum vitae tellus. Mauris non turpis lacus. Pellentesque lorem lacus, iaculis nec egestas vitae, varius eget risus. Nullam feugiat, justo vitae pretium eleifend, eros magna euismod ante, sit amet lacinia massa ligula vel nibh. Praesent dignissim, metus ut commodo tincidunt, odio risus consequat felis, sagittis sollicitudin dolor urna et magna. Phasellus ipsum dolor, interdum eget feugiat non, lacinia nec ligula. Duis commodo aliquam vulputate. Vestibulum tempus eleifend dui, sit amet suscipit tortor pharetra eu. Sed convallis ornare nulla cursus adipiscing. Nulla quis lectus eget arcu ornare sollicitudin. Quisque faucibus posuere lacus, et dapibus mauris iaculis sed. Aenean tellus nisi, sodales vitae dignissim accumsan, semper et lacus}
}
\pdfpagewidth6.5cm
\pdfpageheight1.21\ht0
\hoffset=-2in
\voffset=-1.7in
\box0
\end{document}

Unfortunately I cannot paste an image with the result at this moment, but it is a pdf with a single and very long page.

However, this page is not "infinite", nor can it have an arbitrary length. We are limited by the size of TeX registers. I think that the limit is around 10 meters.

share|improve this answer
1  
Hmmm... 10 m max?... That should do. ;) –  Count Zero Jul 22 '12 at 16:22
1  
Strangely enough that produces 2 pages, when I compile, the first one being blank... Guess that's related to the box exceeding the default page length of article. (There is also the page number on the first page, more or less at the middle of the first page, where I believe the page should normally end.) With \documentclass{standalone} the overfull box error goes away and there is a single page, but the page width is too wide. Got a fix? –  Count Zero Jul 22 '12 at 16:28
    
Sorry, I'm currently far from my computer, on a iPad, and I cannot check nor solve these issues. For the page number you can use nopageno package. –  JLDiaz Jul 22 '12 at 16:36
1  
Why didn't you make it as a document class? –  Please don't touch Jul 22 '12 at 17:28
1  
I only pasted a solution I had in my hard disk, from a similar problem I had time ago. You are welcome to make a class from it. –  JLDiaz Jul 22 '12 at 17:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.