diff options
Diffstat (limited to 'Build/source/texk/texlive')
4 files changed, 185 insertions, 0 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index d0430a31df9..d6a546d80f0 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -134,6 +134,8 @@ texmf_dist_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ + pfarrei/pfarrei.tlu \ + pfarrei/a5toa4.tlu \ pkfix/pkfix.pl \ pkfix-helper/pkfix-helper \ pmx/pmx2pdf.lua \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index ddb83e07f0b..ba119f048c6 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -315,6 +315,8 @@ texmf_dist_other_scripts = \ pdfcrop/pdfcrop.pl \ pedigree-perl/pedigree.pl \ perltex/perltex.pl \ + pfarrei/pfarrei.tlu \ + pfarrei/a5toa4.tlu \ pkfix/pkfix.pl \ pkfix-helper/pkfix-helper \ pmx/pmx2pdf.lua \ diff --git a/Build/source/texk/texlive/linked_scripts/pfarrei/a5toa4.tlu b/Build/source/texk/texlive/linked_scripts/pfarrei/a5toa4.tlu new file mode 100755 index 00000000000..25c7de5986e --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/pfarrei/a5toa4.tlu @@ -0,0 +1,37 @@ +#!/usr/bin/env texlua + +-- +-- This is file `a5toa4.tlu', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- pfarrei.dtx (with options: `a5toa4,lua') +-- +-- Copyright (c) 2013 Markus Kohm +-- komascript at gmx info +-- +-- This file was generated from file(s) of the work `pfarrei'. +-- ------------------------------------------------------------------ +-- +-- It may be distributed under the conditions of the +-- LaTeX Project Public License in the version distributed together +-- with the work `pfarrei'. You may however distribute the work +-- `pfarrei' without all such generated files. See also +-- <http://www.latex-project.org/lppl.txt> for additional +-- information. +-- +-- This work has the LPPL maintenance status `maintained'. +-- +-- The Current Maintainer of this work is Markus Kohm. +-- +-- The list of files belonging to the work `pfarrei' is given in +-- the file `pfarrei.dtx'. +-- +-- $Id: pfarrei.dtx 20 2013-03-10 14:19:06Z mjk $ + +kpse.set_program_name(arg[-1], 'a5toa4') +require('pfarrei') +-- +-- +-- End of file `a5toa4.tlu'. diff --git a/Build/source/texk/texlive/linked_scripts/pfarrei/pfarrei.tlu b/Build/source/texk/texlive/linked_scripts/pfarrei/pfarrei.tlu new file mode 100755 index 00000000000..ee5f0ed8d67 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/pfarrei/pfarrei.tlu @@ -0,0 +1,144 @@ +#!/usr/bin/env texlua + +-- +-- This is file `pfarrei.tlu', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- pfarrei.dtx (with options: `pfarrei,lua') +-- +-- Copyright (c) 2013 Markus Kohm +-- komascript at gmx info +-- +-- This file was generated from file(s) of the work `pfarrei'. +-- ------------------------------------------------------------------ +-- +-- It may be distributed under the conditions of the +-- LaTeX Project Public License in the version distributed together +-- with the work `pfarrei'. You may however distribute the work +-- `pfarrei' without all such generated files. See also +-- <http://www.latex-project.org/lppl.txt> for additional +-- information. +-- +-- This work has the LPPL maintenance status `maintained'. +-- +-- The Current Maintainer of this work is Markus Kohm. +-- +-- The list of files belonging to the work `pfarrei' is given in +-- the file `pfarrei.dtx'. +-- +local version_number = string.sub( '$Revision: 20 $', 12, -2 ) +local action_version = ' r' .. version_number .. '\n' .. [[ + +Copyright (c) 2013 Markus Kohm. +License: lppl 1.3c or later. See <http://www.latex-project.org/lppl.txt>. +]] +local action_help = [[ +action options: + + -h, --help Print this help message. + -V, --version Print the version information. + +processing options: + -b, --booklet Generate a booklet instead of only two pages side by + side onto one page. The whole booklet will be one + signature. + -s, --sidebyside Generate only two pages side by side onto one page + instead of a booklet. + -o, --overwrite Write the output to the <PDF file> instead of appending + "-sidebyside.pdf" or "--booklet.pdf" to the basename + of <PDF file> +]] +local action_opts = { + ['-h'] = 'help', + ['--help'] = 'help', + ['-V'] = 'version', + ['--version'] = 'version', +} +local processing_opts = { + ['-b'] = 'booklet', + ['--booklet'] = 'booklet', + ['-s'] = 'sidebyside', + ['--sidebyside'] = 'sidebyside', + ['-o'] = 'overwrite', + ['--overwrite'] = 'overwrite' +} + +-- detect action options and do action +local i = 1 +local action +while arg[i] do + action = action_opts[arg[i]] + i = i+1 + if action == 'help' then + print( arg[0]..action_version ); + print( 'Usage: ' .. arg[0] .. ' <action option>' ) + print( ' ' .. arg[0] .. ' [<processing options>] <PDF file> ...\n' ) + print( action_help ); + os.exit( 0 ); + elseif action == 'version' then + print( arg[0] .. action_version ); + os.exit( 0 ); + end +end + +-- process options and parameters +local booklet = false +local overwrite = false +i = 1 +while arg[i] do + action = processing_opts[arg[i]] + if action == 'booklet' then booklet = true + elseif action == 'sidebyside' then booklet = false + elseif action == 'overwrite' then overwrite = true + elseif action == nil then + -- build the temporary tex file + local tmpdir = os.tmpdir("pfarrei.XXXXXX" ) + local tmpfile = string.match( arg[i], '.*/(.*)$') or arg[i] + local basename = string.match( tmpfile,'(.*)%.[^.]*$') or tmpfile + tmpfile = tmpdir..'/'..basename..'.tex' + local file = assert( io.open( tmpfile, 'w' ) ) + if booklet then assert( file:write("\\def\\Booklet{}\n") ) end + assert( file:write("\\def\\OriginalFile{",arg[i],"}\n") ) + assert( file:write("\\input{a5toa4.tex}\n") ) + assert( file:flush() ) + file:close() + -- call pdflatex + assert( os.execute( 'pdflatex -interaction=batchmode -output-directory='..tmpdir..' '..tmpfile ) ) + -- copy the resulting pdf file + local srcfile = assert( io.open( tmpdir..'/'..basename..'.pdf', 'rb' ) ) + if overwrite + then + tmpfile = arg[i] + else + tmpfile = string.match( arg[i], '(.*)%.[^.]*$' ) or arg[i] + if booklet + then + tmpfile = tmpfile..'-booklet.pdf' + else + tmpfile = tmpfile..'-sidebyside.pdf' + end + end + local destfile = assert( io.open( tmpfile, 'wb' ) ) + local buffer + while true do + buffer = srcfile:read(8388608) + if buffer==nil then break end + assert( destfile:write(buffer) ) + end + assert( destfile:close() ) + srcfile:close() + tmpfile=tmpdir..'/'..basename + os.remove( tmpfile..'.aux' ) + os.remove( tmpfile..'.tex' ) + os.remove( tmpfile..'.log' ) + os.remove( tmpfile..'.pdf' ) + os.remove( tmpdir ) + overwrite = false + end + i=i+1 +end +-- +-- +-- End of file `pfarrei.tlu'. |