summaryrefslogtreecommitdiffstats
path: root/Doc/text2latex.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-11-05 17:11:16 (GMT)
committerGuido van Rossum <guido@python.org>1993-11-05 17:11:16 (GMT)
commitdb65a6ce556b1e311d03837fbf85ca52ef2c5d07 (patch)
treef46d21f26333d3b232a889fbc9d1784e1139a8a2 /Doc/text2latex.py
parent7a2dba2a00cee7e3dff61849e9111073684b6ab7 (diff)
downloadcpython-db65a6ce556b1e311d03837fbf85ca52ef2c5d07.zip
cpython-db65a6ce556b1e311d03837fbf85ca52ef2c5d07.tar.gz
cpython-db65a6ce556b1e311d03837fbf85ca52ef2c5d07.tar.bz2
* ext.tex: did most of the tedious changes from plain ASCII text to LaTeX.
* text2latex.py: automatically put function names in \code{}. * lib.tex, ref.tex, ext.tex, qua.tex, tut.tex: use new P.O.Box number in address.
Diffstat (limited to 'Doc/text2latex.py')
-rw-r--r--Doc/text2latex.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/text2latex.py b/Doc/text2latex.py
index 3d28431..069155e 100644
--- a/Doc/text2latex.py
+++ b/Doc/text2latex.py
@@ -1,6 +1,7 @@
import os
import sys
import regex
+import regsub
import string
import getopt
@@ -31,6 +32,9 @@ def process(fi, fo):
if fmt:
nextline = '\n'
line = fmt % string.strip(line)
+ if '(' in line:
+ line = regsub.gsub('[a-zA-Z0-9_]+()',
+ '{\\\\tt \\0}', line)
elif inverbatim:
if blank.match(line) >= 0 and \
indented.match(nextline) < 0:
@@ -43,6 +47,9 @@ def process(fi, fo):
fo.write('\\begin{verbatim}\n')
if inverbatim:
line = string.expandtabs(line, 4)
+ elif not fmt and '(' in line:
+ line = regsub.gsub('[a-zA-Z0-9_]+()',
+ '\\\\code{\\0}', line)
fo.write(line)
#main()