summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2008-07-02 22:38:06 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2008-07-02 22:38:06 +0000
commit8183a841446876f5642959166971007c54e51e55 (patch)
tree33b8f0f8b137833bf4dba41089750e132386405a /Master/texmf
parent233db759bb138c08e03c68f92f23b0a474bde04b (diff)
support for context default paper size.
git-svn-id: svn://tug.org/texlive/trunk@9175 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/texconf.tlu115
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl4
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl2
3 files changed, 107 insertions, 14 deletions
diff --git a/Master/texmf/scripts/texlive/texconf.tlu b/Master/texmf/scripts/texlive/texconf.tlu
index cca5629916e..3f00b0ee51f 100755
--- a/Master/texmf/scripts/texlive/texconf.tlu
+++ b/Master/texmf/scripts/texlive/texconf.tlu
@@ -484,6 +484,69 @@ function set_dvipdfm_papersize(papersize, program)
end
end
+
+function set_context_papersize(papersize)
+ local current_setting
+ -- Read the file.
+ local filename
+
+ kpse.set_program_name('tex')
+ filename=kpse.find_file('cont-sys.tex', 'tex')
+ if not(filename) then
+ filename=kpse.find_file('cont-sys.rme', 'other text files')
+ end
+ if not(filename) then
+ print ("Cannot find config file for context, exiting!")
+ os.exit(1)
+ end
+ -- print ('< '..filename)
+
+ local infile=assert(io.open(filename, 'r'))
+ local lines={}
+ local current_setting='A4'
+ local papersize_regexp='^%s*\\setuppapersize%s*%[([^%[]*)%]'
+ while true do
+ line=infile:read('*line')
+ if line == nil then break end
+ if string.find(line, '^%s*\\setuppapersize') then
+ current_setting=string.match(line, papersize_regexp)
+ end
+ lines[#lines+1]=line
+ end
+ infile:close()
+
+ -- print ('current setting: '..current_setting)
+
+ if papersize=='--list' then
+ print(current_setting)
+ if (string.match (current_setting, 'A4')) then
+ print ('letter')
+ else
+ print ('A4')
+ end
+ elseif papersize=='help' then
+ io.stdout:write('Usage: '..usageprogname..' context paper PAPER\n\n'..
+ 'Valid PAPER settings:\n\nA4 letter\n')
+ else --change paper size
+ local outfile
+ mkdirhier(texmfconfig..'/tex/context/user')
+ outfile=texmfconfig..'/tex/context/user/cont-sys.tex'
+ print ('> '..outfile)
+ local config=assert(io.open(outfile, 'w'))
+ for n=1, #lines do
+ line=lines[n]
+ if string.find(line, '\setuppapersize') then
+ config:write('\\setuppapersize['..papersize..']['..papersize..']\n')
+ else
+ config:write(line..'\n')
+ end
+ end
+ config:close()
+ domktexlsr = true
+ end
+end
+
+
function set_papersize(papersize)
if papersize == '--list' then
set_pdftex_papersize('--list')
@@ -504,6 +567,7 @@ function set_papersize(papersize)
end
end
+
function usage_main()
local usage={
'help',
@@ -523,12 +587,14 @@ function usage_main()
os.exit(0)
end
+
function usage_paper(progname)
io.stdout:write('Usage: '..usageprogname..' '..progname..' paper PAPER\n')
io.stdout:write(' '..usageprogname..' '..progname..' help\n')
os.exit(0)
end
+
function set_prog_papersize(prog,size)
if (prog == 'dvips') then
set_dvips_papersize(size)
@@ -568,18 +634,43 @@ elseif arg[1] == 'init' then
os.execute('fmtutil --byfmt "'..arg[i]..'"')
end
end
-elseif arg[1] == 'dvips' or arg[1] == 'xdvi' or arg[1] == 'pdftex' or
- arg[1] == 'dvipdfm' or arg[1] == 'dvipdfmx' then
- if arg[2] == 'help' or arg[2] == nil then
- usage_paper(arg[2])
- elseif arg[2] == 'paper' then
- if arg[3] == 'help' or arg[3] == nil then
- usage_paper(arg[1])
- else
- set_prog_papersize(arg[1], arg[3])
- end
- else
- usage_paper(arg[1])
+elseif arg[1] == 'paper' then
+ set_papersize(arg[2])
+elseif arg[1] == 'dvips' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper('dvips')
+ elseif arg[2]=='paper' then
+ set_dvips_papersize(arg[3])
+ end
+elseif arg[1] == 'xdvi' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper('xdvi')
+ elseif arg[2]=='paper' then
+ set_xdvi_papersize(arg[3])
+ end
+elseif arg[1] == 'pdftex' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper(pdftex)
+ elseif arg[2]=='paper' then
+ set_pdftex_papersize(arg[3])
+ end
+elseif arg[1] == 'dvipdfm' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper('dvipdfm')
+ elseif arg[2]=='paper' then
+ set_dvipdfm_papersize(arg[3], 'dvipdfm')
+ end
+elseif arg[1] == 'dvipdfmx' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper('dvipdfmx')
+ elseif arg[2]=='paper' then
+ set_dvipdfm_papersize(arg[3], 'dvipdfmx')
+ end
+elseif arg[1] == 'context' then
+ if arg[2] == 'help' or arg[3]==nil then
+ usage_paper('context')
+ elseif arg[2]=='paper' then
+ set_context_papersize(arg[3])
end
else
usage_main()
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 35c51d7268a..f19124a1e6d 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -139,7 +139,7 @@ if ($action =~ m/^_include_tlpobj$/) {
merge_into(\%ret, action_remove());
} elsif (($action eq "paper") || ($action eq "dvips") || ($action eq "xdvi") ||
($action eq "pdftex") || ($action eq "dvipdfm") ||
- ($action eq "dvipdfmx")) {
+ ($action eq "dvipdfmx") || ($action eq "context")) {
if ($opt_gui) {
action_gui("config");
}
@@ -1434,7 +1434,7 @@ C<srcfiles> (install source files).
=item B<paper letter>
-=item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx] paper [help|papersize]>
+=item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|papersize]>
Configures the system wide paper settings, either for all programs in
one go, or just for the specified program.
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
index 37d9747731d..46208718e95 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
@@ -97,6 +97,8 @@ chomp(@{$papers{"dvipdfm"}});
chomp(@{$papers{"dvipdfmx"}});
@{$papers{"dvips"}} = `tlmgr dvips paper --list`;
chomp(@{$papers{"dvips"}});
+@{$papers{"context"}} = `tlmgr context paper --list`;
+chomp(@{$papers{"context"}});
my %defaultpaper;
my $row = 2;