Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit
- Loading branch information
Klaus Thoden
committed
Jun 22, 2017
0 parents
commit 364baba
Showing
13 changed files
with
2,500 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__/ | ||
auto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Convert LaTeX to EOAtex | ||
|
||
A script to convert LaTeX into EOAtex. | ||
|
||
Wolfgang Pauli - Korrespondenz7.docx has been converted to LaTeX using oxgarage and was subsequently converted to EOAtex with this script. | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
1,362 changes: 1,362 additions & 0 deletions
1,362
data/Wolfgang Pauli - Korrespondenz7/document.tex
Large diffs are not rendered by default.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8; mode: python -*- | ||
|
||
__version__ = "1.0" | ||
__date__ = "20170621" | ||
__author__ = "kthoden@mpiwg-berlin.mpg.de" | ||
|
||
import sys | ||
import re | ||
|
||
# to be dealt with: EOAfigure | ||
|
||
regex_replacements = { | ||
# r"{\\itshape" : r"\\EOAemph{", | ||
r"\\xref" : r"\\EOAurl", | ||
r"\\uline{\\itshape " : r"\\EOAemph{", | ||
r"{\\itshape " : r"\\EOAemph{", | ||
r"\\uline\{" : r"\\EOAcaps{", | ||
r"\\par" : "\\n\\n", | ||
r"{\\bfseries " : r"\\EOAbold{", | ||
r"\\label\{ftn[0-9]{1,3}}\\footnote" : "\\EOAfn", | ||
r"\\footnote" : r"\\EOAfn", | ||
r"\\label" : r"\\EOAlabel", | ||
r"{enumerate}" : r"{EOAlist}", | ||
r"{itemize}" : r"{EOAitems}", | ||
r"\\color{FF0000}" : r"\\color[rgb]{1,0,0}", | ||
r"\\color{0000FF}" : r"\\color[rgb]{0,0,1}" | ||
} | ||
|
||
def find_latex_commands(string): | ||
"""Finds latex commands in a text, return a list of unique | ||
occurrences. | ||
""" | ||
|
||
command_pattern = re.compile(r'\\[a-zA-Z0-9]+', re.UNICODE) | ||
found_commands = set(re.findall(command_pattern, string)) | ||
|
||
return found_commands | ||
# def find_latex_commands ends here | ||
|
||
def main(infile): | ||
"""The main bit""" | ||
|
||
with open(infile, 'r') as input_file: | ||
data = input_file.read() | ||
|
||
# list_of_commands = find_latex_commands(input_text) | ||
|
||
for instance in regex_replacements.keys(): | ||
data = re.sub(instance, regex_replacements[instance], data) | ||
|
||
print(data) | ||
# def main ends here | ||
|
||
if __name__ == '__main__': | ||
infile = sys.argv[-1] | ||
main(infile) | ||
# finis | ||
|