RagnarGrootKoerkamp / BAPCtools

Tools for developing ICPC-style programming contest problems.
GNU General Public License v3.0
50 stars 23 forks source link

`bt zip --kattis`: Export `problem_statement/**/*.{pdf|jpg|etc}` #323

Closed thorehusfeldt closed 1 year ago

thorehusfeldt commented 1 year ago

With bt zip --kattis, we copy problem_statement/problem.XY.tex. Such a file typically includes

\illustration{0.3}{img/sample5.png}{
  Sample input~5, (R)-homocamptothecin, a tertiary alcohol.
In this 2D visualisation, carbon atoms appear as unlabelled vertices
and hydrogens are implicit except for the hydroxy group.}

or

\hspace*{1cm}\includegraphics{img/methanol.pdf}\,.\noindent

and – since the required images are not copied – therefore won’t compile from the zipped archive.

Solutions:

  1. Copy all of problem_statetemt/*. This would typically also pick up things like solution.en.tex(which we could explicitly suppress) but also various .aux, .log, .tex, .pgf, that we don’t want
  2. Copy all of problem_statement/**/*.{png|jpg|gif|pdf|etc} for a well-defined list of image formats
  3. As 2, but be more restrictive, such as problem_statement/img/*.{png|jpg|gif|pdf|etc}

I weakly favour 2.

RagnarGrootKoerkamp commented 1 year ago

I could see situations where people include a separate figure.tex file containing some tikz, so we'd also want to include .tex files I think.

So yes, option 2 sound good, but extending it with .tex also:

problem_statement/**/*.{png,jpg,gif,pdf,svg,tex}

Alternatively we could do 1 but exclude gitignored files. That sounds too complicated though.

We could also just do 1 without excluding anything. That would be simple and least surprising probably, and always works, even though it may contain redundant files.

thorehusfeldt commented 1 year ago

So… problem_statement/**/*.{tex|png|jpg|pdf|etc}, except problem_statement/solutions.*.tex?

thorehusfeldt commented 1 year ago

I forgot the 4th option:

  1. Parse and recursively follow various \include, \includgraphics, and \illustration macros and include the mentioned files.

I think that road leads to heartbreak.

RagnarGrootKoerkamp commented 1 year ago

Or 5.: Keep the current situation and only include files problem_statement/*, and if you want anything deeper you have to copy/symlink them over into problem_statement/ directly

thorehusfeldt commented 1 year ago

5 it is.