Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problems Exporting to PDF

  • To: mathgroup at
  • Subject: [mg115750] Re: Problems Exporting to PDF
  • From: AES <siegman at>
  • Date: Thu, 20 Jan 2011 06:26:37 -0500 (EST)
  • References: <ih6egp$3ih$>

In article <ih6egp$3ih$1 at>, Bob Hanlon <hanlonr at> 

> You could break it into pages
> linesPerPage = 40;
> grid5 = Grid[#, Frame -> All] & /@
>    Partition[
>     Join[
>      Table[Flatten[
>        {StandardForm["Question " <> ToString[n]],
>         RandomInteger[{10^5, 10^8}, 5]}],
>       {n, 100}],
>      Table[{}, {linesPerPage - 1}]],
>     linesPerPage];
> Table[Export["grid5" <> "_" <> ToString[n] <> ".pdf",
>   grid5[[n]]], {n, Length[grid5]}]
> {"grid5_1.pdf", "grid5_2.pdf", "grid5_3.pdf"}
> Bob Hanlon

I have no quarrel at all with an example like the above (and admiration 
for those who can code this kind of thing).  

But thinking back on the recent threads about procedural vs functional 
programming and trying to decipher what this code does for myself makes 
it ever more clear why my approach to the same problem --  and I think 
the recommended approach for most Mathematica users -- would be something like a Do loop, generating and exporting one "block" (one example of 
"grid5_n.pdf") per loop.

And suppose instead Helen Read wanted to generate many questions of 
varying length (let each question be a separate "grid5_n" block), and 
then export as many individual questions to a page as would fit on that 
exported page, but never have the last question on a page run off the 
bottom of the page, or over to the next page?  (The process that TeX 
handles so beautifully and easily with \filbreak)  How might that be 
coded functionally?

(And of course there could be a fews cases where an occasional "grid5_n" 
question or block is individually longer than a single page . . . )

  • Prev by Date: Re: adding a keyboard shortcut for double brackets
  • Next by Date: Re: adding a keyboard shortcut for double brackets
  • Previous by thread: Re: Problems Exporting to PDF
  • Next by thread: Re: Problems Exporting to PDF