I am a very beginner in LaTeX, and need to know if it is possible to do next. There is a book, consisting of text and photos, going one by one. Questions:

  1. Is it possible in LaTeX to make images height change automatically in some predefined range, in order to get specified number of pages in resulting book? Aspect ratio should be preserved, and images height on each page may be different, in order to fill all the page, if possible.
  2. If 1. is "yes" — are there packages to perform such task?
  3. If 1. is "yes" and 2. is "no" — need some ideas, how that could be done.
  • 5
    answer yes or no depending. LaTeX (and tex generally) is designed to hold very little more than one page in memory at any one time (1970's architecture) so scaling a fixed number of images to fill a page is easily supported, optimising the image placement over the whole document is not supported and would require a complete rewrite of latex's page making routines, that is not impossible (probably, how hard can it be....) but rather more code than an answer here or possibly more code than a beginner in LaTeX would want. – David Carlisle Feb 2 '16 at 10:07
  • @DavidCarlisle can you make this an answer? – touhami Feb 2 '16 at 10:32
  • Would it be possible to use some iterative hack? I.e. read the number of pages from the previous run and make the size of the images larger/smaller for the next run by some factor (and possibly stretch all images if they fit on one page). If the parameters are right, this could converge to the target number of pages. – senegrom Feb 2 '16 at 11:29
  • @touhami it's more of a comment than an answer. I'll leave it a bit someone may want to suggest some code for at least parts of the problem. – David Carlisle Feb 2 '16 at 11:47
  • Regarding @senegrom 's sugggestion, one could read the current scale factor from the aux file (if defined), then compute the next iteration scale fact using the \AtEndDocument hook. To guarantee convergence, one wold need to also write the delta used and always use a smaller delta with each iteration. – John Kormylo Feb 2 '16 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.