Skip to content

Commit

Permalink
Re-changed structure to avoid Overleaf hack; closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainhalle committed Dec 10, 2018
1 parent 0cabfb1 commit 1e23dad
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 36 deletions.
12 changes: 4 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,13 @@ Overleaf integration

[Overleaf](https://www.overleaf.com) is an online collaborative platform for
editing LaTeX documents. Provided you have run `set-style.php` once, you can
import the whole project structure into overleaf and edit it there; don't forget
import the whole project structure into Overleaf and edit it there; don't forget
to set `Source/paper.tex` as the main file.

If you want to change the document to another article class, simply re-run
`set-style.php` on your computer and re-upload `preamble.inc.tex` and
`postamble.inc.tex` to Overleaf. This is even easier if you keep Overleaf in
sync with a GitHub repository.

Note that you need a little
[hack](https://github.com/sylvainhalle/PaperShell/issues/11) if you want the
compilation of references to work in Overleaf.
`set-style.php` on your computer and re-upload `preamble.inc.tex`,
`midamble.inc.tex` and `postamble.inc.tex` to Overleaf. This is even easier if
you keep Overleaf in sync with a GitHub repository.

Cleaning up a BibTeX file
-------------------------
Expand Down
2 changes: 2 additions & 0 deletions Source/paper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ \section{Donec id eros non nisl pharetra} %% {{{
%% ---------------------------
%% Bibliography and postamble
%% ---------------------------
\input{midamble.inc.tex}
\bibliography{paper}
\input{postamble.inc.tex}

\end{document}
Expand Down
109 changes: 81 additions & 28 deletions set-style.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
**************************************************************************/

// Version
$version_string = "2.0";
$version_string = "2.1";
$autogen_comment = "%% This file was autogenerated by PaperShell v$version_string on ".date("Y-m-d H:i:s")."\n%% https://github.com/sylvainhalle/PaperShell\n%% DO NOT EDIT!";

// Read author-title file
Expand Down Expand Up @@ -237,9 +237,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -332,12 +337,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);

// IEEE Journal: samething
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -437,9 +444,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -527,9 +539,14 @@
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\n\\section*{References}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -631,9 +648,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -741,9 +763,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -850,10 +877,15 @@
EOD;
$out .= "\n\\input{acm-bottom.tex}\n";
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "% History dates\n\\received{".date("F Y")."}{".date("F Y")."}{".date("F Y")."}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
}

Expand Down Expand Up @@ -956,9 +988,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -1059,9 +1096,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -1171,9 +1213,14 @@
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "% NOTE: the plainurl style is available in Ubuntu using texlive-bibtex-extra\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

Expand Down Expand Up @@ -1279,20 +1326,26 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\n\\bibliographystyle{".$bib_style."}\n";
$out .= "\\bibliography{".$config["bib-name"]."}\n";
file_put_contents($out_folder."midamble.inc.tex", $out);
$out = "";
$out .= <<<EOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{$autogen_comment}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOD;
$out .= "\\input{appendices.tex}\n";
$out .= "\\end{document}\n";
file_put_contents($out_folder."postamble.inc.tex", $out);
} // }}}

if ($generated)
{
echo "\nDone. Go to the Source folder and type `make' to compile the paper.\n";
echo "\nGenerated ".$config["style"]." preamble and postamble.\n";
echo "Go to the Source folder and type `make' to compile the paper.\n";
exit(0);
}
else
{
echo "Invalid style. Available styles are: lncs, ieee, acmconf, elsevier,\n";
echo "\nInvalid style. Available styles are: lncs, ieee, acmconf, elsevier,\n";
echo "springer, aaai, acmjour, eptcs, stvr, lipics, easychair.\n";
exit(1);
}
Expand Down

0 comments on commit 1e23dad

Please sign in to comment.