64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
import os
|
|
import subprocess
|
|
import glob
|
|
|
|
# LaTeX Wrapper Template
|
|
LATEX_WRAPPER = r"""
|
|
\documentclass[11pt,a4paper]{article}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage{amsmath,amssymb,amsfonts,amsthm}
|
|
\usepackage{cite}
|
|
\usepackage{hyperref}
|
|
|
|
\title{Intellecton Canon: Volume {vol_num} Master Key}
|
|
\author{The Fold Within Research Institute}
|
|
\date{\today}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
|
|
\input{{filename}}
|
|
|
|
\end{document}
|
|
"""
|
|
|
|
def compile_latex(filename, outname):
|
|
# Run pdflatex twice for references
|
|
subprocess.run(['pdflatex', '-interaction=nonstopmode', f'-jobname={outname}', filename], check=False)
|
|
subprocess.run(['pdflatex', '-interaction=nonstopmode', f'-jobname={outname}', filename], check=False)
|
|
|
|
def main():
|
|
base_dir = '/home/antigravity/intellecton/papers'
|
|
|
|
# Volume 1 is already a complete LaTeX file
|
|
vol1_dir = os.path.join(base_dir, 'project_paper_1_relativity/master_key')
|
|
os.chdir(vol1_dir)
|
|
compile_latex('paper_1_master_key.tex', 'Volume_1_Master_Key')
|
|
subprocess.run(['mc', 'cp', 'Volume_1_Master_Key.pdf', 'cloud/intellecton-pdfs/'])
|
|
|
|
# Volumes 2 to 6
|
|
vols = [
|
|
('project_paper_2_neuroscience', 'v2.1_comprehensive.tex', 2),
|
|
('project_paper_3_darwinism', 'v3.1_comprehensive.tex', 3),
|
|
('project_paper_4_fbt', 'v4.1_comprehensive.tex', 4),
|
|
('project_paper_5_turing', 'v5.1_comprehensive.tex', 5),
|
|
('project_paper_6_holographic', 'v6.1_comprehensive.tex', 6),
|
|
]
|
|
|
|
for d, f, vol_num in vols:
|
|
working_dir = os.path.join(base_dir, d, 'master_key')
|
|
os.chdir(working_dir)
|
|
|
|
wrapper_name = f'wrapper_vol{vol_num}.tex'
|
|
with open(wrapper_name, 'w') as out:
|
|
out.write(LATEX_WRAPPER.replace('{vol_num}', str(vol_num)).replace('{filename}', f))
|
|
|
|
compile_latex(wrapper_name, f'Volume_{vol_num}_Master_Key')
|
|
subprocess.run(['mc', 'cp', f'Volume_{vol_num}_Master_Key.pdf', 'cloud/intellecton-pdfs/'])
|
|
|
|
# Set bucket to public download just in case
|
|
subprocess.run(['mc', 'anonymous', 'set', 'download', 'cloud/intellecton-pdfs'])
|
|
|
|
if __name__ == '__main__':
|
|
main()
|