|
|
@@ -326,6 +326,7 @@ END;
|
|
|
$tex = "";
|
|
|
$paper_fulltitle = "";
|
|
|
$authors = "";
|
|
|
+ $institute = "";
|
|
|
if (str_ends_with($f,".pdf"))
|
|
|
{
|
|
|
$paper_fulltitle = trim(user_prompt("Please enter the full title for the paper in folder '$d'","TODO"));
|
|
|
@@ -356,6 +357,13 @@ file_put_contents("$d/main.tex",$header);
|
|
|
if (isset($authors[2]) && isset($authors[2][0]))
|
|
|
$authors = trim(stripformatting($authors[2][0]));
|
|
|
}
|
|
|
+ if ($institute == "" && preg_match("/\n\s*\\\\institute/i",$tex) == 1)
|
|
|
+ {
|
|
|
+ $institute = [];
|
|
|
+ preg_match_all("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$institute);
|
|
|
+ if (isset($institute[2]) && isset($institute[2][0]))
|
|
|
+ $institute = trim(stripformatting($institute[2][0]));
|
|
|
+ }
|
|
|
if ($paper_fulltitle == "" && preg_match("/\n\s*\\\\title/i",$tex) == 1)
|
|
|
{
|
|
|
$title = [];
|
|
|
@@ -391,21 +399,34 @@ $paper_fulltitle%
|
|
|
\\vspace{0.6cm}
|
|
|
{\large $authors%
|
|
|
} % TODO: check author list
|
|
|
+{\large $institute%
|
|
|
+} % TODO: check author list
|
|
|
\\end{center}
|
|
|
END;
|
|
|
}
|
|
|
- $tex = preg_replace("/\\\documentclass.*\\n/i",'',$tex);
|
|
|
+ $tex = preg_replace("/\\\documentclass.*\\n/i","
|
|
|
+",$tex);
|
|
|
$tex = preg_replace("/\\\begin{document}/i",$header,$tex);
|
|
|
$tex = preg_replace("/\\\begin{abstract}/i",'\section*{Abstract}',$tex);
|
|
|
+ $tex = preg_replace("/\\\\newcommand/i",'\providecommand',$tex);
|
|
|
$tex = preg_replace("/\\\\end{abstract}/i",'',$tex);
|
|
|
$tex = preg_replace("/\\\\thispagestyle{empty}/i",'',$tex);
|
|
|
+ $tex = preg_replace("/\\\\PassOptionsToPackage\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i",'',$tex);
|
|
|
+ $tex = preg_replace("/(\\\\csvautobooktabular\s*([^{}]*)\s*)(?<R>{((?:[^{}]+|(?&R))*)})/i","\\1{{$d}/\\4}",$tex);
|
|
|
$tex = preg_replace("/\\\\bibliographystyle\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
+ $tex = preg_replace("/\\\\usetikzlibrary\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
+ $tex = preg_replace("/\\\\DeclareFloatFont\s*(?<R>{((?:[^{}]+|(?&R))*)})(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
+ $tex = preg_replace("/\\\\captionsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])?(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
+ $tex = preg_replace("/\\\\tikzexternalize\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])/i","",$tex);
|
|
|
+ $tex = preg_replace("/\\\\floatsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\bibliography\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\end{document}/i",'',$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
+ $tex = preg_replace("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\date\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\maketitle/i","",$tex);
|
|
|
+ $tex = preg_replace("/\n\s*\\\\tikzexternalize/i","",$tex);
|
|
|
[$ups,$ps] = getusepackages($tex);
|
|
|
global $included_usepackages;
|
|
|
global $additional_usepackages;
|