|
@@ -256,6 +256,7 @@ END;
|
|
|
$bib = preg_replace("/(^\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
$bib = preg_replace("/(^\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
|
$bib = preg_replace("/(\n\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
$bib = preg_replace("/(\n\s*@\s*[a-z]+\s*\{\s*)((?!$d)\S)/i",'${1}'.$d.':${2}',$bib);
|
|
|
$bib = preg_replace("/([\{\"].*)[^\\\\]#(.*)/i",'${1}\#${2}',$bib);
|
|
$bib = preg_replace("/([\{\"].*)[^\\\\]#(.*)/i",'${1}\#${2}',$bib);
|
|
|
|
|
+ $bib = preg_replace("/{\\\\i}/","{i}",$bib);
|
|
|
file_put_contents($file,$bib);
|
|
file_put_contents($file,$bib);
|
|
|
$bibresources[$d] = $file;
|
|
$bibresources[$d] = $file;
|
|
|
}
|
|
}
|
|
@@ -377,19 +378,19 @@ file_put_contents("$d/main.tex",$header);
|
|
|
if (!str_ends_with($file,".tex") && !str_ends_with($file,".tikz") && !str_ends_with($file,".sty"))
|
|
if (!str_ends_with($file,".tex") && !str_ends_with($file,".tikz") && !str_ends_with($file,".sty"))
|
|
|
continue;
|
|
continue;
|
|
|
$tex = file_get_and_backup($file,".interm_bak");
|
|
$tex = file_get_and_backup($file,".interm_bak");
|
|
|
- if ($authors == "" && preg_match("/\n\s*\\\\author/i",$tex) == 1)
|
|
|
|
|
|
|
+ if ($authors == "" && preg_match("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex) == 1)
|
|
|
{
|
|
{
|
|
|
preg_match_all("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$authors);
|
|
preg_match_all("/\n\s*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$authors);
|
|
|
if (isset($authors[2]) && isset($authors[2][0]))
|
|
if (isset($authors[2]) && isset($authors[2][0]))
|
|
|
$authors = trim(stripformatting($authors[2][0]));
|
|
$authors = trim(stripformatting($authors[2][0]));
|
|
|
}
|
|
}
|
|
|
- if ($institute == "" && preg_match("/\n\s*\\\\institute/i",$tex) == 1)
|
|
|
|
|
|
|
+ if ($institute == "" && preg_match("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex) == 1)
|
|
|
{
|
|
{
|
|
|
preg_match_all("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$institute);
|
|
preg_match_all("/\n\s*\\\\institute\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$institute);
|
|
|
if (isset($institute[2]) && isset($institute[2][0]))
|
|
if (isset($institute[2]) && isset($institute[2][0]))
|
|
|
$institute = trim(stripformatting($institute[2][0]));
|
|
$institute = trim(stripformatting($institute[2][0]));
|
|
|
}
|
|
}
|
|
|
- if ($paper_fulltitle == "" && preg_match("/\n\s*\\\\title/i",$tex) == 1)
|
|
|
|
|
|
|
+ if ($paper_shorttitle == "" && preg_match("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex) == 1)
|
|
|
{
|
|
{
|
|
|
preg_match_all("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$title);
|
|
preg_match_all("/\n\s*\\\\title\s*(?<R>{((?:[^{}]+|(?&R))*)})/i",$tex,$title);
|
|
|
if (isset($title[2]) && isset($title[2][0]))
|
|
if (isset($title[2]) && isset($title[2][0]))
|
|
@@ -404,10 +405,10 @@ file_put_contents("$d/main.tex",$header);
|
|
|
$paper_shorttitle = trim(user_prompt("Please enter a short title for the paper in folder '$d'","$shorttitle"));
|
|
$paper_shorttitle = trim(user_prompt("Please enter a short title for the paper in folder '$d'","$shorttitle"));
|
|
|
}
|
|
}
|
|
|
$header = "";
|
|
$header = "";
|
|
|
- if ($paper_fulltitle != "" && $authors != "")
|
|
|
|
|
|
|
+ if ($paper_fulltitle != "" && $paper_shorttitle != "" && $authors != "")
|
|
|
{
|
|
{
|
|
|
$header=<<<END
|
|
$header=<<<END
|
|
|
-\chapter[$paper_shorttitle]{$paper_fulltitle}\label{chapter:$d}
|
|
|
|
|
|
|
+\chapter[$paper_shorttitle]{{$paper_fulltitle}}\label{chapter:$d}
|
|
|
\section*{Publication Data}
|
|
\section*{Publication Data}
|
|
|
\\fullcite{TODO}
|
|
\\fullcite{TODO}
|
|
|
|
|
|
|
@@ -443,8 +444,8 @@ END;
|
|
|
",$tex);
|
|
",$tex);
|
|
|
$tex = preg_replace("/\\\begin{document}/i",$header,$tex);
|
|
$tex = preg_replace("/\\\begin{document}/i",$header,$tex);
|
|
|
$tex = preg_replace("/\\\begin{abstract}/i",'\section*{Abstract}',$tex);
|
|
$tex = preg_replace("/\\\begin{abstract}/i",'\section*{Abstract}',$tex);
|
|
|
- $tex = preg_replace("/\\\\newcommand/i",'\providecommand',$tex);
|
|
|
|
|
- $tex = preg_replace("/\\\\renewcommand/i",'\providecommand',$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\\\\newcommand/i",'\declarecommand',$tex);
|
|
|
|
|
+ $tex = preg_replace("/\\\\renewcommand/i",'\declarecommand',$tex);
|
|
|
$tex = preg_replace("/\\\\end{abstract}/i",'',$tex);
|
|
$tex = preg_replace("/\\\\end{abstract}/i",'',$tex);
|
|
|
$tex = preg_replace("/\\\\DeclareMathOperator/i",'%$0',$tex);
|
|
$tex = preg_replace("/\\\\DeclareMathOperator/i",'%$0',$tex);
|
|
|
$tex = preg_replace("/\\\\DeclareMathAlphabet/i",'%$0',$tex);
|
|
$tex = preg_replace("/\\\\DeclareMathAlphabet/i",'%$0',$tex);
|
|
@@ -458,7 +459,9 @@ END;
|
|
|
$tex = preg_replace("/\\\\captionsetup\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("/\\\\tikzexternalize\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])/i","",$tex);
|
|
|
$tex = preg_replace("/\\\\floatsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
$tex = preg_replace("/\\\\floatsetup\s*(?<R>\[((?:[^\[\]]+|(?&R))*)\])(?<Q>{((?:[^{}]+|(?&Q))*)})/i","",$tex);
|
|
|
- $tex = preg_replace("/\s*\\\\bibliography\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
|
|
|
|
+ $tex = preg_replace("/\s*\\\\bibliography\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","\n".'\begin{sloppypar}
|
|
|
|
|
+\printbibliography[title={References}, heading=subbibliography]
|
|
|
|
|
+\end{sloppypar}',$tex);
|
|
|
$tex = preg_replace("/\\\\end{document}/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*\\\\author\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
|
$tex = preg_replace("/\n\s*\\\\authorrunning\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
$tex = preg_replace("/\n\s*\\\\authorrunning\s*(?<R>{((?:[^{}]+|(?&R))*)})/i","",$tex);
|
|
@@ -479,7 +482,7 @@ END;
|
|
|
$additional_usepackages[] = "\usepackage{minted}";
|
|
$additional_usepackages[] = "\usepackage{minted}";
|
|
|
$included_usepackages[] = $v;
|
|
$included_usepackages[] = $v;
|
|
|
}
|
|
}
|
|
|
- else if (!in_array($v,['usenix','usenix,epsfig,endnotes','usenixbadges','cite','csvenhanced']) && !($v == 'floatrow' && in_array('float',$included_usepackages)))
|
|
|
|
|
|
|
+ else if (!in_array($v,['usenix','usenix,epsfig,endnotes','flushend','mathptmx','usenixbadges','cite','csvenhanced']) && !($v == 'floatrow' && in_array('float',$included_usepackages)))
|
|
|
{
|
|
{
|
|
|
$additional_usepackages[] = $ups[$k];
|
|
$additional_usepackages[] = $ups[$k];
|
|
|
$included_usepackages[] = $v;
|
|
$included_usepackages[] = $v;
|
|
@@ -494,7 +497,7 @@ END;
|
|
|
$rmcommands = array_intersect($newcommands,$existing_commands);
|
|
$rmcommands = array_intersect($newcommands,$existing_commands);
|
|
|
foreach ($rmcommands as $rmc)
|
|
foreach ($rmcommands as $rmc)
|
|
|
{
|
|
{
|
|
|
- $tex = preg_replace("/\n\s*\\\\newcommand([^{}]*)({\s*\\".$rmc."\s*}.*\n)/i","\n",$tex);
|
|
|
|
|
|
|
+ //$tex = preg_replace("/\n\s*\\\\newcommand([^{}]*)({\s*\\".$rmc."\s*}.*\n)/i","\n",$tex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$matches = [];
|
|
$matches = [];
|
|
@@ -683,7 +686,12 @@ END;
|
|
|
file_put_contents("intro.tex","");
|
|
file_put_contents("intro.tex","");
|
|
|
|
|
|
|
|
if (!file_exists("main.bib"))
|
|
if (!file_exists("main.bib"))
|
|
|
- file_put_contents("main.bib","");
|
|
|
|
|
|
|
+ file_put_contents("main.bib",'@inproceedings{Kocher2019,
|
|
|
|
|
+ author = {Paul Kocher and Jann Horn and Anders Fogh and Daniel Genkin and Daniel Gruss and Werner Haas and Mike Hamburg and Moritz Lipp and Stefan Mangard and Thomas Prescher and Michael Schwarz and Yuval Yarom},
|
|
|
|
|
+ booktitle = {S\&P},
|
|
|
|
|
+ title = {{Spectre Attacks: Exploiting Speculative Execution}},
|
|
|
|
|
+ year = {2019}
|
|
|
|
|
+}');
|
|
|
if (isset($options["--cv"]))
|
|
if (isset($options["--cv"]))
|
|
|
{
|
|
{
|
|
|
if (!file_exists("cv.bib"))
|
|
if (!file_exists("cv.bib"))
|
|
@@ -692,5 +700,23 @@ END;
|
|
|
file_put_contents("cv.tex","This is my CV! Thanks for checking it out!");
|
|
file_put_contents("cv.tex","This is my CV! Thanks for checking it out!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ ob_start();
|
|
|
|
|
+ require "cover1.tex.php";
|
|
|
|
|
+ $covertex_content = ob_get_contents();
|
|
|
|
|
+ ob_end_clean();
|
|
|
|
|
+ if (!file_exists("cover1.tex") || user_consent("cover1.tex already exists. overwrite?"))
|
|
|
|
|
+ file_put_contents("cover1.tex",$covertex_content);
|
|
|
|
|
+
|
|
|
|
|
+ shell_exec('latexmk -latexoption="-shell-escape" -g -pdf cover1.tex 1>/dev/null 2>/dev/null');
|
|
|
|
|
+
|
|
|
|
|
+ ob_start();
|
|
|
|
|
+ require "cover2.tex.php";
|
|
|
|
|
+ $covertex_content = ob_get_contents();
|
|
|
|
|
+ ob_end_clean();
|
|
|
|
|
+ if (!file_exists("cover2.tex") || user_consent("cover2.tex already exists. overwrite?"))
|
|
|
|
|
+ file_put_contents("cover2.tex",$covertex_content);
|
|
|
|
|
+
|
|
|
|
|
+ shell_exec('latexmk -latexoption="-shell-escape" -g -pdf cover2.tex 1>/dev/null 2>/dev/null');
|
|
|
|
|
+
|
|
|
echo "=== done ===\nNext step, run this command:\nlatexmk -latexoption=\"-shell-escape\" -g -pdf main.tex\n";
|
|
echo "=== done ===\nNext step, run this command:\nlatexmk -latexoption=\"-shell-escape\" -g -pdf main.tex\n";
|
|
|
?>
|
|
?>
|