ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] How to tell a single *.tex file to produce separate PDFs?
       [not found] <348911354.5371554.1726801061779.ref@mail.yahoo.com>
@ 2024-09-20  2:57 ` Joel via ntg-context
  2024-09-20  8:23   ` [NTG-context] " vm via ntg-context
                     ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Joel via ntg-context @ 2024-09-20  2:57 UTC (permalink / raw)
  To: Mailing List for ConTeXt Users; +Cc: Joel


[-- Attachment #1.1: Type: text/plain, Size: 1219 bytes --]

I have a document that's quite long. It uses a recurse function, a bit like this:

\starttext

    \dostepwiserecurse{1}{180}{1}{%
       \input chapter\recurselevel

}
\stoptext
That produces 180  chapters of content.
Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.

The problem is, I've been splitting the file by using Print --> PDF and choosing a custom print range, and then saving it. If I ned to repeat that 180 times, it not only will have errors, but probably take 5-10 hours.
Is there something I can put, like \breakpdf or something that will tell it to start a new PDF file? They can be named something like file1.pdf, file2.pdf, etc.
\starttext

    \dostepwiserecurse{1}{136}{1}{%
       \input chapter\recurselevel
\breakpdf

}
\stoptext
The perhaps "obvious" answer is just make 180  *.tex files, but since the minimal example above is like 0.01% of the complexity of the real file, that isn't so easy...

--Joel

[-- Attachment #1.2: Type: text/html, Size: 3099 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
@ 2024-09-20  8:23   ` vm via ntg-context
  2024-09-20  8:33     ` Denis Maier via ntg-context
  2024-09-20 10:26   ` Wolfgang Schuster
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: vm via ntg-context @ 2024-09-20  8:23 UTC (permalink / raw)
  To: ntg-context; +Cc: vm



On 20/09/2024 04:57, Joel via ntg-context wrote:
> 
> Anyway, my boss is upset she has to use a table of contents to navigate 
> to the page she wants, and so wants me to split the file into 180  
> separate files, which somehow is going to be easier to look at. 
> Honestly, she probably still won't ever actually look at it, but that's 
> her requirement.


what is the difference between scrolling through your single page files 
folder and scrolling through a single pdf?

How about <ctrl-f> too search in the pdf?


with mutools you can take a pdf aprt into individual pages.


$ mutool --help
usage: mutool <command> [options]
	clean	-- rewrite pdf file
	convert	-- convert document
	create	-- create pdf document
	draw	-- convert document
	trace	-- trace device calls
	extract	-- extract font and image resources
	info	-- show information about pdf resources
	merge	-- merge pages from multiple pdf sources into a new pdf
	pages	-- show information about pdf pages
	poster	-- split large page into many tiles
	sign	-- manipulate PDF digital signatures
	run	-- run javascript
	show	-- show internal pdf objects


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  8:23   ` [NTG-context] " vm via ntg-context
@ 2024-09-20  8:33     ` Denis Maier via ntg-context
  2024-09-20  9:58       ` vm via ntg-context
  2024-09-21  0:38       ` Alan Braslau via ntg-context
  0 siblings, 2 replies; 13+ messages in thread
From: Denis Maier via ntg-context @ 2024-09-20  8:33 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'; +Cc: denismaier

I was going to suggest pdftk which is similar to mutools. You can get
boundaries from a the log file and then split the file using these tools.
(Search the mailing list: I think that's also something ConTeXt might be
able to do natively, but I'm not sure.)

Then, you might also consider using a product-component based solution.
You'll then be able to process each file indivdually while still having a
main file around. The page numbers in the individual file will be incorrect,
i.e. always start at 1, but for having a quick look that still might be
nice. (Hans or Wolfgang probably know if there is a way to get correct page
numbers when using components...)

Best,
Denis

> -----Ursprüngliche Nachricht-----
> Von: vm via ntg-context <ntg-context@ntg.nl>
> Gesendet: Freitag, 20. September 2024 10:23
> An: ntg-context@ntg.nl
> Cc: vm <vm@klankschap.nl>
> Betreff: [NTG-context] Re: How to tell a single *.tex file to produce
separate
> PDFs?
> 
> 
> 
> On 20/09/2024 04:57, Joel via ntg-context wrote:
> >
> > Anyway, my boss is upset she has to use a table of contents to
> > navigate to the page she wants, and so wants me to split the file into
> > 180 separate files, which somehow is going to be easier to look at.
> > Honestly, she probably still won't ever actually look at it, but
> > that's her requirement.
> 
> 
> what is the difference between scrolling through your single page files
folder
> and scrolling through a single pdf?
> 
> How about <ctrl-f> too search in the pdf?
> 
> 
> with mutools you can take a pdf aprt into individual pages.
> 
> 
> $ mutool --help
> usage: mutool <command> [options]
> 	clean	-- rewrite pdf file
> 	convert	-- convert document
> 	create	-- create pdf document
> 	draw	-- convert document
> 	trace	-- trace device calls
> 	extract	-- extract font and image resources
> 	info	-- show information about pdf resources
> 	merge	-- merge pages from multiple pdf sources into a new pdf
> 	pages	-- show information about pdf pages
> 	poster	-- split large page into many tiles
> 	sign	-- manipulate PDF digital signatures
> 	run	-- run javascript
> 	show	-- show internal pdf objects
> 
> 
> ______________________________________________________________
> _____________________
> If your question is of interest to others as well, please add an entry to
the
> Wiki!
> 
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-
> context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net
> (mirror) archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ______________________________________________________________
> _____________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  8:33     ` Denis Maier via ntg-context
@ 2024-09-20  9:58       ` vm via ntg-context
  2024-09-21  0:38       ` Alan Braslau via ntg-context
  1 sibling, 0 replies; 13+ messages in thread
From: vm via ntg-context @ 2024-09-20  9:58 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'; +Cc: vm



On 20/09/2024 10:33, denismaier@mailbox.org wrote:
indeed:> I was going to suggest pdftk which is similar to mutools.

indeed:

pdftk document.pdf burst

will generate pg_nnnn.pdf individual pdf

pg_0001,pdf
pg_0002,pdf
pg_0003,pdf
pg_0004,pdf
...
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
  2024-09-20  8:23   ` [NTG-context] " vm via ntg-context
@ 2024-09-20 10:26   ` Wolfgang Schuster
  2024-09-20 13:05     ` Denis Maier via ntg-context
  2024-09-20 13:46   ` Pablo Rodriguez via ntg-context
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Schuster @ 2024-09-20 10:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Joel via ntg-context

Joel via ntg-context schrieb am 20.09.2024 um 04:57:
> I have a document that's quite long. It uses a recurse function, a bit 
> like this:
> 
> \starttext
> 
>      \dostepwiserecurse{1}{180}{1}{%
> 
>         \input chapter\recurselevel
> 
> }
> 
> \stoptext
> 
> That produces 180  chapters of content.
> 
> Anyway, my boss is upset she has to use a table of contents to navigate 
> to the page she wants, and so wants me to split the file into 180  
> separate files, which somehow is going to be easier to look at. 
> Honestly, she probably still won't ever actually look at it, but that's 
> her requirement.
> 
> The problem is, I've been splitting the file by using Print --> PDF and 
> choosing a custom print range, and then saving it. If I ned to repeat 
> that 180 times, it not only will have errors, but probably take 5-10 hours.
> 
> Is there something I can put, like \breakpdf or something that will tell 
> it to start a new PDF file? They can be named something like file1.pdf, 
> file2.pdf, etc.
> 
> \starttext
> 
>      \dostepwiserecurse{1}{136}{1}{%
> 
>         \input chapter\recurselevel
> 
> \breakpdf
> 
> }
> 
> \stoptext
> 
> The perhaps "obvious" answer is just make 180  *.tex files, but since 
> the minimal example above is like 0.01% of the complexity of the real 
> file, that isn't so easy...

You can use the pdf script file but it's slower than mutool or pdftk.

mtxrun --script pdf --split file.pdf

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20 10:26   ` Wolfgang Schuster
@ 2024-09-20 13:05     ` Denis Maier via ntg-context
  2024-09-20 16:04       ` Wolfgang Schuster
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Maier via ntg-context @ 2024-09-20 13:05 UTC (permalink / raw)
  To: 'mailing list for ConTeXt users'; +Cc: denismaier

> -----Ursprüngliche Nachricht-----
> Von: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
> Gesendet: Freitag, 20. September 2024 12:26
> An: mailing list for ConTeXt users <ntg-context@ntg.nl>; Joel via ntg-context <ntg-
> context@ntg.nl>
> Betreff: [NTG-context] Re: How to tell a single *.tex file to produce separate
> PDFs?
> 
> You can use the pdf script file but it's slower than mutool or pdftk.
> 
> mtxrun --script pdf --split file.pdf
> 

Where will this split the pdf? At certain headers?

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
  2024-09-20  8:23   ` [NTG-context] " vm via ntg-context
  2024-09-20 10:26   ` Wolfgang Schuster
@ 2024-09-20 13:46   ` Pablo Rodriguez via ntg-context
  2024-09-20 16:41   ` Jim
  2024-09-20 17:04   ` Bruce Horrocks
  4 siblings, 0 replies; 13+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2024-09-20 13:46 UTC (permalink / raw)
  To: Joel via ntg-context; +Cc: Pablo Rodriguez

On 9/20/24 04:57, Joel via ntg-context wrote:
> [...]
> The perhaps "obvious" answer is just make 180  *.tex files, but since
> the minimal example above is like 0.01% of the complexity of the real
> file, that isn't so easy...

Hi Joel,

I tried to recreate a document with chapters that contain a different
number of pages each:

\setuppagenumbering[alternative=doublesided]
\setuphead[chapter][reference=ch\the\numexpr\namedheadnumber{chapter}+1]
\starttext
  \dorecurse{180}{%
    \startchapter[title={Chapter \namedheadnumber{chapter}}]
      \dorecurse{\randomnumber{10}{50}}
        {\input zapf\par}
    \stopchapter}
\stoptext

The key above is setting a reference for each chapter, so that they may
be retrieved later automatically.

Then you should have the pages for any chapter from its reference with
the following command:

  context --pages=ch100 main-file.tex

But I must confess, I cannot get this working. I don’t know what I miss.

If you are on Unix, generating a bash loop would be similar to (once
your main PDF document has been generated):

  for i in {1..180}; do mutool merge -o chapter-$i.pdf main-file\
  "$(context --pages=ch$i main-file)"

But for that, you need to know first how "--pages=[reference]" may work.

Just in case it might help,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20 13:05     ` Denis Maier via ntg-context
@ 2024-09-20 16:04       ` Wolfgang Schuster
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfgang Schuster @ 2024-09-20 16:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Denis Maier via ntg-context

Denis Maier via ntg-context schrieb am 20.09.2024 um 15:05:
>> -----Ursprüngliche Nachricht-----
>> Von: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
>> Gesendet: Freitag, 20. September 2024 12:26
>> An: mailing list for ConTeXt users <ntg-context@ntg.nl>; Joel via ntg-context <ntg-
>> context@ntg.nl>
>> Betreff: [NTG-context] Re: How to tell a single *.tex file to produce separate
>> PDFs?
>>
>> You can use the pdf script file but it's slower than mutool or pdftk.
>>
>> mtxrun --script pdf --split file.pdf
>>
> Where will this split the pdf? At certain headers?

This splits the pdf into single pages and there are no options.

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
                     ` (2 preceding siblings ...)
  2024-09-20 13:46   ` Pablo Rodriguez via ntg-context
@ 2024-09-20 16:41   ` Jim
  2024-09-20 17:04   ` Bruce Horrocks
  4 siblings, 0 replies; 13+ messages in thread
From: Jim @ 2024-09-20 16:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Sep 20, 2024 at 02:57 (+0000), Joel via ntg-context wrote:

> I have a document that's quite long. It uses a recurse function, a bit like this:

> \starttext

>     \dostepwiserecurse{1}{180}{1}{%
>        \input chapter\recurselevel

> }
> \stoptext
> That produces 180  chapters of content.
> Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.

> The problem is, I've been splitting the file by using Print --> PDF and choosing a custom print range, and then saving it. If I ned to repeat that 180 times, it not only will have errors, but probably take 5-10 hours.
> Is there something I can put, like \breakpdf or something that will tell it to start a new PDF file? They can be named something like file1.pdf, file2.pdf, etc.
> \starttext

>     \dostepwiserecurse{1}{136}{1}{%
>        \input chapter\recurselevel
> \breakpdf

> }
> \stoptext
> The perhaps "obvious" answer is just make 180  *.tex files, but since the minimal example above is like 0.01% of the complexity of the real file, that isn't so easy...

Joel,

others have suggested mutool and pdftk, which could be half the solution
for you.  (I use pdftk for things like this, but I assume mutool is just as
good.  Either are far less tedious than printing to file.)

If the information of the chapter boundaries is available in the log file,
a judicious use of grep and a few lines of shell script code might do the
trick.  Alternatively, you might be able to use a tool like pdfgrep to find
the page numbers from the PDF file, and then use a few lines of shell code.

If you are a Linux or Mac user, this should be "easy enough".  I don't do
windows, but now that there is (as I understand it) a bash shell available,
you might also be able to use grep and/or pdfgrep there as well.

If the log file isn't currently sufficiently helpful, could you add
something to your "start a new chapter" command to write a comment into the
log file giving you exactly the information you need?

                                Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
                     ` (3 preceding siblings ...)
  2024-09-20 16:41   ` Jim
@ 2024-09-20 17:04   ` Bruce Horrocks
  2024-09-21  0:06     ` Joel via ntg-context
  2024-09-23  9:32     ` Otared Kavian
  4 siblings, 2 replies; 13+ messages in thread
From: Bruce Horrocks @ 2024-09-20 17:04 UTC (permalink / raw)
  To: ntg-context mailing list



> On 20 Sep 2024, at 03:57, Joel via ntg-context <ntg-context@ntg.nl> wrote:
> 
> I have a document that's quite long. It uses a recurse function, a bit like this:
> 
> \starttext
> 
>     \dostepwiserecurse{1}{180}{1}{%
> 
>        \input chapter\recurselevel
> 
> }
> 
> \stoptext
> 
> That produces 180  chapters of content.
> 
> Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.

Since you’ve already got the chapter content split into separate \input files ...

At the Unix level, use the following script to run Context 180 times specifying a different output file each time:

#! /bin/bash
for i in {1..180}
do
  context \
    --arguments="ChapNo=$i" test.tex \
    --result="chapter_$i.pdf”
done

And at the Context level, test.tex is simply:

\starttext
  \input chapter\env{ChapNo}
\stoptext


Regards,
—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20 17:04   ` Bruce Horrocks
@ 2024-09-21  0:06     ` Joel via ntg-context
  2024-09-23  9:32     ` Otared Kavian
  1 sibling, 0 replies; 13+ messages in thread
From: Joel via ntg-context @ 2024-09-21  0:06 UTC (permalink / raw)
  To: ntg-context mailing list, Bruce Horrocks; +Cc: Joel


[-- Attachment #1.1: Type: text/plain, Size: 1530 bytes --]

 I am using Linux, so those tools are available, but Bruce's solution is working great! Just had to make tiny changes to the file.
I had no idea I could send an environment variable to ConTeXt...will be using that a lot from now! Thanks very much everyone for the help!

    On Friday, September 20, 2024 at 11:04:47 AM MDT, Bruce Horrocks <ntg@scorecrow.com> wrote:  
 
 

> On 20 Sep 2024, at 03:57, Joel via ntg-context <ntg-context@ntg.nl> wrote:
> 
> I have a document that's quite long. It uses a recurse function, a bit like this:
> 
> \starttext
> 
>    \dostepwiserecurse{1}{180}{1}{%
> 
>        \input chapter\recurselevel
> 
> }
> 
> \stoptext
> 
> That produces 180  chapters of content.
> 
> Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.

Since you’ve already got the chapter content split into separate \input files ...

At the Unix level, use the following script to run Context 180 times specifying a different output file each time:

#! /bin/bash
for i in {1..180}
do
  context \
    --arguments="ChapNo=$i" test.tex \
    --result="chapter_$i.pdf”
done

And at the Context level, test.tex is simply:

\starttext
  \input chapter\env{ChapNo}
\stoptext


Regards,
—
Bruce Horrocks
Hampshire, UK

  

[-- Attachment #1.2: Type: text/html, Size: 3353 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20  8:33     ` Denis Maier via ntg-context
  2024-09-20  9:58       ` vm via ntg-context
@ 2024-09-21  0:38       ` Alan Braslau via ntg-context
  1 sibling, 0 replies; 13+ messages in thread
From: Alan Braslau via ntg-context @ 2024-09-21  0:38 UTC (permalink / raw)
  To: Denis Maier via ntg-context; +Cc: Alan Braslau

On Fri, 20 Sep 2024 10:33:55 +0200
Denis Maier via ntg-context <ntg-context@ntg.nl> wrote:

> I was going to suggest pdftk which is similar to mutools.

There is also qpdf.

However, running a shell script to run context many times is my
favorite solution.

This question brings up the topic: would it be useful to be able to do
the same within context, either using lua or TeX programming?

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [NTG-context] Re: How to tell a single *.tex file to produce separate PDFs?
  2024-09-20 17:04   ` Bruce Horrocks
  2024-09-21  0:06     ` Joel via ntg-context
@ 2024-09-23  9:32     ` Otared Kavian
  1 sibling, 0 replies; 13+ messages in thread
From: Otared Kavian @ 2024-09-23  9:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2361 bytes --]

Hi Bruce,

I had an analogous problem a while ago, but with 7 chapter files, which I treated manually…
Your solution is a very nice one, thank you for sharing ! 

For the archives, if one wishes to have the correct chapter number in each separate PDF file, one could change the content of « test.tex » file as follows:

\starttext
\setupheadnumber[chapter][\cldcontext{\env{ChapNo}-1}]
\input chapter-\env{ChapNo}.tex
\stoptext

Best regards: Otared


> On 20 Sep 2024, at 19:04, Bruce Horrocks <ntg@scorecrow.com> wrote:
> 
> 
> 
>> On 20 Sep 2024, at 03:57, Joel via ntg-context <ntg-context@ntg.nl> wrote:
>> 
>> I have a document that's quite long. It uses a recurse function, a bit like this:
>> 
>> \starttext
>> 
>>    \dostepwiserecurse{1}{180}{1}{%
>> 
>>       \input chapter\recurselevel
>> 
>> }
>> 
>> \stoptext
>> 
>> That produces 180  chapters of content.
>> 
>> Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.
> 
> Since you’ve already got the chapter content split into separate \input files ...
> 
> At the Unix level, use the following script to run Context 180 times specifying a different output file each time:
> 
> #! /bin/bash
> for i in {1..180}
> do
>  context \
>    --arguments="ChapNo=$i" test.tex \
>    --result="chapter_$i.pdf”
> done
> 
> And at the Context level, test.tex is simply:
> 
> \starttext
>  \input chapter\env{ChapNo}
> \stoptext
> 
> 
> Regards,
> —
> Bruce Horrocks
> Hampshire, UK
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________

Otared Kavian
e-mail: otared@gmail.com
Phone: +33 6 88 26 70 95





[-- Attachment #1.2: Type: text/html, Size: 4697 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-09-23  9:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <348911354.5371554.1726801061779.ref@mail.yahoo.com>
2024-09-20  2:57 ` [NTG-context] How to tell a single *.tex file to produce separate PDFs? Joel via ntg-context
2024-09-20  8:23   ` [NTG-context] " vm via ntg-context
2024-09-20  8:33     ` Denis Maier via ntg-context
2024-09-20  9:58       ` vm via ntg-context
2024-09-21  0:38       ` Alan Braslau via ntg-context
2024-09-20 10:26   ` Wolfgang Schuster
2024-09-20 13:05     ` Denis Maier via ntg-context
2024-09-20 16:04       ` Wolfgang Schuster
2024-09-20 13:46   ` Pablo Rodriguez via ntg-context
2024-09-20 16:41   ` Jim
2024-09-20 17:04   ` Bruce Horrocks
2024-09-21  0:06     ` Joel via ntg-context
2024-09-23  9:32     ` Otared Kavian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).