@jutge.org/toolkit 4.2.7 → 4.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/latex/root-pdf.tpl.tex +29 -0
- package/assets/latex/root-text.tpl.tex +34 -0
- package/assets/problems/demo/demo.pbm/README.md +24 -0
- package/assets/problems/demo/demo.pbm/award.html +1 -0
- package/assets/problems/demo/demo.pbm/award.png +0 -0
- package/assets/problems/demo/demo.pbm/campanar.png +0 -0
- package/assets/problems/demo/demo.pbm/handler.yml +2 -0
- package/assets/problems/demo/demo.pbm/jutge.png +0 -0
- package/assets/problems/demo/demo.pbm/jutge.svg +27 -0
- package/assets/problems/demo/demo.pbm/problem.en.tex +301 -0
- package/assets/problems/demo/demo.pbm/problem.en.yml +3 -0
- package/assets/problems/demo/demo.pbm/sample-1.inp +1 -0
- package/assets/problems/demo/demo.pbm/sample-2.inp +1 -0
- package/assets/problems/demo/demo.pbm/solution.py +5 -0
- package/assets/sty/{judgeit.sty → jutge.sty} +40 -38
- package/dist/index.js +529 -545
- package/docs/problem-anatomy.md +4 -0
- package/package.json +10 -4
- package/toolkit/ask.ts +1 -1
- package/toolkit/convert.ts +72 -0
- package/toolkit/index.ts +2 -0
- /package/assets/sty/{judgeit.ca.sty → jutge.ca.sty} +0 -0
- /package/assets/sty/{judgeit.de.sty → jutge.de.sty} +0 -0
- /package/assets/sty/{judgeit.en.sty → jutge.en.sty} +0 -0
- /package/assets/sty/{judgeit.es.sty → jutge.es.sty} +0 -0
- /package/assets/sty/{judgeit.fr.sty → jutge.fr.sty} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
\documentclass[11pt]{article}
|
|
2
|
+
|
|
3
|
+
\usepackage{jutge}
|
|
4
|
+
\usepackage{{curly jutgeLanguage}}
|
|
5
|
+
|
|
6
|
+
\begin{document}
|
|
7
|
+
|
|
8
|
+
\providecommand{\SampleOneCol}{{curly samples1c}}
|
|
9
|
+
\providecommand{\SampleTwoCol}{{curly samples2c}}
|
|
10
|
+
|
|
11
|
+
\ProblemId{{curly id}}
|
|
12
|
+
|
|
13
|
+
\DoProblem{{curly language}}
|
|
14
|
+
|
|
15
|
+
\ProblemInformation
|
|
16
|
+
|
|
17
|
+
\Author: {{author}}
|
|
18
|
+
|
|
19
|
+
{{#if translator}}
|
|
20
|
+
{{language}}: {{translator}}
|
|
21
|
+
{{/if}}
|
|
22
|
+
|
|
23
|
+
\Generation: {{date}}
|
|
24
|
+
|
|
25
|
+
\subsection*{Draft}
|
|
26
|
+
|
|
27
|
+
Draft generated with \textbf{new-jutge-toolkit}.
|
|
28
|
+
|
|
29
|
+
\end{document}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
\documentclass[11pt]{article}
|
|
3
|
+
|
|
4
|
+
\usepackage{jutge}
|
|
5
|
+
\usepackage{{curly jutgeLanguage}}
|
|
6
|
+
|
|
7
|
+
% redefine commands to simplify text output
|
|
8
|
+
\renewcommand{\Sample}{}
|
|
9
|
+
\renewcommand{\Statement}{}
|
|
10
|
+
\renewcommand{\Problem}[1]{\section{#1}}
|
|
11
|
+
\ProblemId{{curly id}}
|
|
12
|
+
|
|
13
|
+
% redefine figure commands to avoid troubles with \parpic
|
|
14
|
+
\renewcommand{\FigureL}[2]{\includegraphics[#1]{#2}}
|
|
15
|
+
\renewcommand{\FigureC}[2]{\includegraphics[#1]{#2}}
|
|
16
|
+
\renewcommand{\FigureR}[2]{\includegraphics[#1]{#2}}
|
|
17
|
+
|
|
18
|
+
\begin{document}
|
|
19
|
+
|
|
20
|
+
\DoProblem{{curly language}}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
\subsection*{\TxtAuthor}
|
|
24
|
+
{{author}}
|
|
25
|
+
|
|
26
|
+
{{#if translator}}
|
|
27
|
+
{{language}}: {{translator}}
|
|
28
|
+
{{/if}}
|
|
29
|
+
|
|
30
|
+
\subsection*{Draft}
|
|
31
|
+
|
|
32
|
+
Draft generated with \textbf{new-jutge-toolkit}.
|
|
33
|
+
|
|
34
|
+
\end{document}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Demo Problem
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
- Text formatting
|
|
6
|
+
- Special characters
|
|
7
|
+
- Mathematical expressions
|
|
8
|
+
- Conditional rendering
|
|
9
|
+
- Images
|
|
10
|
+
- Code snippets
|
|
11
|
+
- Inline code
|
|
12
|
+
- Colors
|
|
13
|
+
- PS Tricks
|
|
14
|
+
- Tikz
|
|
15
|
+
- Chessboards
|
|
16
|
+
- Sectioning macros
|
|
17
|
+
- Programming language configurations
|
|
18
|
+
- Interface descriptions
|
|
19
|
+
- Scoring descriptions
|
|
20
|
+
- Sample input/output macros
|
|
21
|
+
|
|
22
|
+
## Abstract
|
|
23
|
+
|
|
24
|
+
This document is a comprehensive guide to creating problem statements for Jutge.org using LaTeX, covering text formatting, mathematical expressions, code snippets, images, and various specialized features that render across multiple output formats (PDF, HTML, Markdown, and plain text).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Problem solved, congratulations!</p>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg viewBox="0 0 49 66" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path fill="#ffffff" d=" M 0.00 0.00 L 49.00 0.00 L 49.00 66.00 L 0.00 66.00 L 0.00 0.00 Z" />
|
|
5
|
+
<path fill="#464847" d=" M 5.72 8.49 C 6.65 5.88 9.84 6.49 12.00 6.32 C 21.01 6.50 30.02 6.34 39.03 6.32 C 40.76 6.13 42.43 6.94 43.21 8.52 C 43.99 11.55 43.27 14.84 44.11 17.80 C 45.49 18.74 47.21 19.77 47.28 21.66 C 47.57 23.41 46.00 24.67 45.21 26.06 C 47.18 27.64 47.91 30.03 46.63 32.31 C 46.71 31.15 46.79 29.98 46.88 28.82 C 46.14 27.92 45.41 27.03 44.68 26.13 C 44.04 26.10 42.76 26.05 42.12 26.03 C 41.49 27.57 40.06 29.17 40.86 30.92 C 41.39 33.00 43.85 33.12 45.45 33.98 C 44.55 33.82 42.74 33.51 41.84 33.35 C 40.04 31.03 40.09 28.17 41.84 25.81 C 40.26 23.77 40.33 21.30 40.77 18.88 C 37.72 17.01 34.77 14.89 32.72 11.90 C 34.54 13.79 36.46 15.59 38.56 17.17 C 39.93 17.96 41.47 19.42 42.88 17.84 C 44.24 15.47 43.16 12.61 43.11 10.05 C 43.20 7.96 41.25 6.85 39.46 6.48 C 32.48 6.54 25.50 6.63 18.53 6.68 C 16.37 6.61 14.21 6.55 12.05 6.54 C 10.13 6.74 7.87 6.51 6.32 7.86 C 5.39 11.06 5.70 14.45 5.52 17.74 C 6.58 18.46 7.64 19.17 8.70 19.89 C 11.13 19.27 13.57 18.66 15.98 17.96 C 19.12 16.97 22.25 15.98 25.32 14.78 C 27.32 13.94 29.27 12.98 31.18 11.95 C 24.53 16.43 16.45 17.90 8.88 20.13 C 8.62 22.91 8.08 25.75 5.00 26.90 C 9.37 25.00 8.70 30.27 7.98 32.56 C 5.46 33.78 1.28 34.45 2.18 38.30 C 2.42 38.75 2.90 39.67 3.13 40.12 C 0.60 38.45 1.82 35.18 3.71 33.63 C 0.39 30.62 4.11 26.38 1.94 23.02 C 0.97 20.66 3.26 18.57 5.20 17.67 C 5.41 14.61 5.20 11.52 5.72 8.49 Z" />
|
|
6
|
+
<path fill="#d5d5d5" d=" M 6.32 7.86 C 7.87 6.51 10.13 6.74 12.05 6.54 C 12.54 7.29 13.02 8.04 13.51 8.79 C 13.09 10.26 12.68 11.74 12.26 13.22 C 12.90 13.46 13.54 13.69 14.18 13.93 C 13.28 15.78 14.45 16.99 15.98 17.96 C 13.57 18.66 11.13 19.27 8.70 19.89 C 7.64 19.17 6.58 18.46 5.52 17.74 C 5.70 14.45 5.39 11.06 6.32 7.86 Z" />
|
|
7
|
+
<path fill="#e4e4e4" d=" M 12.05 6.54 C 14.21 6.55 16.37 6.61 18.53 6.68 C 20.09 7.21 21.63 7.79 23.17 8.36 C 22.89 9.77 22.61 11.18 22.33 12.59 C 23.32 13.32 24.32 14.05 25.32 14.78 C 22.25 15.98 19.12 16.97 15.98 17.96 C 14.45 16.99 13.28 15.78 14.18 13.93 C 13.54 13.69 12.90 13.46 12.26 13.22 C 12.68 11.74 13.09 10.26 13.51 8.79 C 13.02 8.04 12.54 7.29 12.05 6.54 Z" />
|
|
8
|
+
<path fill="#efefef" d=" M 18.53 6.68 C 25.50 6.63 32.48 6.54 39.46 6.48 C 39.93 10.07 39.67 13.70 38.56 17.17 C 36.46 15.59 34.54 13.79 32.72 11.90 C 32.59 11.75 32.34 11.45 32.22 11.31 C 31.96 11.47 31.44 11.79 31.18 11.95 C 29.27 12.98 27.32 13.94 25.32 14.78 C 24.32 14.05 23.32 13.32 22.33 12.59 C 22.61 11.18 22.89 9.77 23.17 8.36 C 21.63 7.79 20.09 7.21 18.53 6.68 Z" />
|
|
9
|
+
<path fill="#dcdcdc" d=" M 39.46 6.48 C 41.25 6.85 43.20 7.96 43.11 10.05 C 43.16 12.61 44.24 15.47 42.88 17.84 C 41.47 19.42 39.93 17.96 38.56 17.17 C 39.67 13.70 39.93 10.07 39.46 6.48 Z" />
|
|
10
|
+
<path fill="#eddccb" d=" M 31.18 11.95 C 31.44 11.79 31.96 11.47 32.22 11.31 C 32.34 11.45 32.59 11.75 32.72 11.90 C 34.77 14.89 37.72 17.01 40.77 18.88 C 40.33 21.30 40.26 23.77 41.84 25.81 C 40.09 28.17 40.04 31.03 41.84 33.35 C 41.41 33.73 40.56 34.50 40.13 34.88 C 39.32 37.93 41.17 40.39 43.38 42.23 C 43.19 44.60 42.88 47.27 40.80 48.81 C 34.15 49.95 27.38 48.20 20.72 49.27 C 16.63 49.71 12.51 49.40 8.41 49.50 C 6.00 47.26 4.74 44.15 5.12 40.82 C 6.22 40.66 7.32 40.50 8.41 40.28 C 8.40 38.61 8.51 36.93 8.45 35.26 C 8.33 34.59 8.09 33.23 7.98 32.56 C 8.70 30.27 9.37 25.00 5.00 26.90 C 8.08 25.75 8.62 22.91 8.88 20.13 C 16.45 17.90 24.53 16.43 31.18 11.95 Z" />
|
|
11
|
+
<path fill="#d7d7d7" d=" M 2.22 23.09 C 1.70 20.80 3.49 19.19 5.02 17.85 C 6.16 18.58 7.31 19.29 8.46 20.01 C 8.15 21.93 8.48 25.04 5.98 25.54 C 4.18 26.33 3.46 23.87 2.22 23.09 Z" />
|
|
12
|
+
<path fill="#d3d4d6" d=" M 45.25 25.74 C 40.12 27.53 38.76 18.01 44.07 18.46 C 47.42 19.29 47.41 23.62 45.25 25.74 Z" />
|
|
13
|
+
<path fill="#010402" d=" M 17.98 33.17 C 15.74 29.78 14.92 23.82 18.91 21.44 C 21.17 24.83 21.95 30.76 17.98 33.17 Z" />
|
|
14
|
+
<path fill="#010203" d=" M 29.14 21.46 C 32.98 23.76 32.90 30.75 29.24 33.21 C 26.65 29.84 26.67 24.89 29.14 21.46 Z" />
|
|
15
|
+
<path fill="#d9d9d8" d=" M 42.12 26.03 C 42.76 26.05 44.04 26.10 44.68 26.13 C 45.41 27.03 46.14 27.92 46.88 28.82 C 46.79 29.98 46.71 31.15 46.63 32.31 C 46.58 33.00 46.56 33.69 46.51 34.38 C 46.13 36.60 47.07 40.17 44.00 40.64 C 40.91 40.56 40.88 37.08 40.13 34.88 C 40.56 34.50 41.41 33.73 41.84 33.35 C 42.74 33.51 44.55 33.82 45.45 33.98 C 43.85 33.12 41.39 33.00 40.86 30.92 C 40.06 29.17 41.49 27.57 42.12 26.03 Z" />
|
|
16
|
+
<path fill="#dbdbdb" d=" M 2.80 28.85 C 3.51 26.64 6.12 27.70 7.75 26.96 C 8.55 29.07 8.65 32.43 5.96 33.15 C 3.43 34.66 1.97 30.77 2.80 28.85 Z" />
|
|
17
|
+
<path fill="#d2d7da" d=" M 2.18 38.30 C 1.28 34.45 5.46 33.78 7.98 32.56 C 8.09 33.23 8.33 34.59 8.45 35.26 C 8.27 36.63 8.19 38.01 8.07 39.39 C 6.69 39.84 5.29 40.32 3.82 40.21 L 3.13 40.12 C 2.90 39.67 2.42 38.75 2.18 38.30 Z" />
|
|
18
|
+
<path fill="#010100" d=" M 8.07 39.39 C 8.19 38.01 8.27 36.63 8.45 35.26 C 8.51 36.93 8.40 38.61 8.41 40.28 C 7.32 40.50 6.22 40.66 5.12 40.82 C 4.74 44.15 6.00 47.26 8.41 49.50 C 12.51 49.40 16.63 49.71 20.72 49.27 L 20.54 50.18 C 20.62 51.20 20.78 53.23 20.86 54.25 C 20.73 54.37 20.47 54.60 20.33 54.71 C 20.23 53.25 20.10 51.79 19.94 50.34 L 19.86 49.75 C 17.08 49.84 14.34 50.37 11.67 51.13 C 10.64 55.18 10.12 60.32 13.94 63.11 C 10.65 63.03 7.36 63.03 4.07 63.23 C 4.50 59.08 5.38 54.97 5.25 50.78 C 6.59 47.65 4.40 44.24 4.75 40.92 C 4.35 40.72 3.54 40.32 3.13 40.12 L 3.82 40.21 C 5.29 40.32 6.69 39.84 8.07 39.39 Z" />
|
|
19
|
+
<path fill="#ada093" d=" M 40.13 34.88 C 40.88 37.08 40.91 40.56 44.00 40.64 C 47.07 40.17 46.13 36.60 46.51 34.38 C 48.63 37.10 47.01 40.23 44.25 41.58 C 44.13 44.42 43.59 47.22 42.21 49.73 C 39.66 49.59 37.11 49.56 34.57 49.57 C 32.54 49.55 30.51 49.67 28.49 49.78 L 27.71 49.81 C 25.32 49.95 22.93 50.08 20.54 50.18 L 20.72 49.27 C 27.38 48.20 34.15 49.95 40.80 48.81 C 42.88 47.27 43.19 44.60 43.38 42.23 C 41.17 40.39 39.32 37.93 40.13 34.88 Z" />
|
|
20
|
+
<path fill="#010100" d=" M 14.82 39.58 C 20.72 42.70 27.94 42.40 34.04 39.98 C 29.44 45.66 19.14 45.53 14.82 39.58 Z" />
|
|
21
|
+
<path fill="#fcfbfa" d=" M 8.31 46.79 C 14.53 46.25 20.78 46.66 27.02 46.57 C 31.59 46.66 36.21 46.11 40.73 46.98 C 38.81 48.56 36.23 48.11 33.93 48.17 C 26.97 48.01 20.01 48.13 13.05 48.15 C 11.49 47.85 9.06 48.72 8.31 46.79 Z" />
|
|
22
|
+
<path fill="#242424" d=" M 11.67 51.13 C 14.34 50.37 17.08 49.84 19.86 49.75 L 19.94 50.34 C 18.51 50.73 16.95 50.86 15.66 51.64 C 15.11 55.44 14.34 60.00 17.09 63.17 C 16.31 63.15 14.73 63.13 13.94 63.11 C 10.12 60.32 10.64 55.18 11.67 51.13 Z" />
|
|
23
|
+
<path fill="#fefefe" d=" M 20.54 50.18 C 22.93 50.08 25.32 49.95 27.71 49.81 C 27.92 54.50 29.55 58.90 31.07 63.28 C 26.70 63.47 22.33 63.45 17.96 63.25 C 18.77 60.41 19.69 57.60 20.33 54.71 C 20.47 54.60 20.73 54.37 20.86 54.25 C 20.78 53.23 20.62 51.20 20.54 50.18 Z" />
|
|
24
|
+
<path fill="#464847" d=" M 27.71 49.81 L 28.49 49.78 C 30.20 50.31 31.87 50.92 33.55 51.52 C 34.86 55.45 34.59 59.62 32.25 63.10 C 32.87 63.08 34.10 63.03 34.72 63.00 C 38.13 62.98 41.53 62.99 44.94 63.19 C 31.34 63.76 17.68 63.61 4.07 63.23 C 7.36 63.03 10.65 63.03 13.94 63.11 C 14.73 63.13 16.31 63.15 17.09 63.17 C 14.34 60.00 15.11 55.44 15.66 51.64 C 16.95 50.86 18.51 50.73 19.94 50.34 C 20.10 51.79 20.23 53.25 20.33 54.71 C 19.69 57.60 18.77 60.41 17.96 63.25 C 22.33 63.45 26.70 63.47 31.07 63.28 C 29.55 58.90 27.92 54.50 27.71 49.81 Z" />
|
|
25
|
+
<path fill="#212121" d=" M 28.49 49.78 C 30.51 49.67 32.54 49.55 34.57 49.57 C 35.77 50.19 36.95 50.85 38.14 51.51 C 37.76 54.84 37.55 58.19 37.49 61.54 C 36.57 62.04 35.65 62.53 34.72 63.00 C 34.10 63.03 32.87 63.08 32.25 63.10 C 34.59 59.62 34.86 55.45 33.55 51.52 C 31.87 50.92 30.20 50.31 28.49 49.78 Z" />
|
|
26
|
+
<path fill="#010202" d=" M 34.57 49.57 C 37.11 49.56 39.66 49.59 42.21 49.73 L 43.50 49.80 C 43.39 54.31 44.30 58.75 44.94 63.19 C 41.53 62.99 38.13 62.98 34.72 63.00 C 35.65 62.53 36.57 62.04 37.49 61.54 C 37.55 58.19 37.76 54.84 38.14 51.51 C 36.95 50.85 35.77 50.19 34.57 49.57 Z" />
|
|
27
|
+
</svg>
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
\Problem{Demo Problem}
|
|
2
|
+
|
|
3
|
+
\Statement
|
|
4
|
+
|
|
5
|
+
\paragraph{Abstract.}
|
|
6
|
+
|
|
7
|
+
This a demo problem whose statement includes many elements that can be used in Jutge.org.
|
|
8
|
+
Please refer to its source code to see how to include these elements in your own problem statements.
|
|
9
|
+
|
|
10
|
+
\medskip
|
|
11
|
+
|
|
12
|
+
Problems statements are written in \LaTeX, which allows for great flexibility and high-quality typesetting.
|
|
13
|
+
Resulting statements are rendered in PDF, HTML, Markdown, and plain Text formats. Jutge.org aims to have
|
|
14
|
+
a consistent appearance across all formats, although some features may vary depending on the capabilities of each format.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
\paragraph{Text.}
|
|
18
|
+
|
|
19
|
+
Regular text is just written as \LaTeX.
|
|
20
|
+
It is important to remember to separate paragraphs with the \verb|\medskip| macro.
|
|
21
|
+
|
|
22
|
+
\medskip
|
|
23
|
+
|
|
24
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum.
|
|
25
|
+
Cras venenatis euismod malesuada.
|
|
26
|
+
Nullam ac erat ante.
|
|
27
|
+
Sed vel lacus id mauris dapibus facilisis.
|
|
28
|
+
Nam euismod, tortor nec pharetra ultricies, ante erat imperdiet velit, nec laoreet enim lacus a velit.
|
|
29
|
+
|
|
30
|
+
\medskip
|
|
31
|
+
|
|
32
|
+
Latin accents and special characters are supported out of the box: Bé, sí, allà algú dirà: «Què farà l'avió demà?» "Potser" vindrà ràpid, però demanarà atenció.
|
|
33
|
+
Greek letters works well: Καλημέρα, πώς είστε σήμερα.
|
|
34
|
+
Asiatic languages work well in HTML but not in PDF: 你好,很高兴认识你。「はじめまして、よろしくお願いします。」.
|
|
35
|
+
Emojis work well in HTML but not so-so in PDF: ⚠ 😀 .
|
|
36
|
+
|
|
37
|
+
\paragraph{Maths.}
|
|
38
|
+
|
|
39
|
+
The use of mathematical expressions is also supported.
|
|
40
|
+
They can be included inline, like the famous $E = mc^2$ formula or simply as $\sqrt x$, or as separate displayed equations.
|
|
41
|
+
For example, we can write the quadratic formula as follows:
|
|
42
|
+
|
|
43
|
+
\[
|
|
44
|
+
x = \frac{{-b \pm \sqrt{{b^2 - 4ac}}}}{{2a}}
|
|
45
|
+
\]
|
|
46
|
+
|
|
47
|
+
or express the Pythagorean theorem:
|
|
48
|
+
|
|
49
|
+
\[
|
|
50
|
+
a^2 + b^2 = c^2
|
|
51
|
+
\]
|
|
52
|
+
|
|
53
|
+
The rendering of these expressions will use MathML in the HTML version, ensuring very nice results.
|
|
54
|
+
In the Text and Markdown versions, mathematical expressions will be represented using some unicode symbols or in LaTeX format.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
\paragraph{Conditional rendering.}
|
|
58
|
+
|
|
59
|
+
Some parts of the statement can be conditionally included depending on the output format.
|
|
60
|
+
|
|
61
|
+
\medskip
|
|
62
|
+
|
|
63
|
+
\begin{latexonly}
|
|
64
|
+
This text is only included in the PDF version of the statement.
|
|
65
|
+
\end{latexonly}
|
|
66
|
+
|
|
67
|
+
\begin{htmlonly}
|
|
68
|
+
This text is only included in the HTML, Markdown and Text versions of the statement.
|
|
69
|
+
\end{htmlonly}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
\paragraph{Images.}
|
|
74
|
+
|
|
75
|
+
Images can also be included in the statement. For instance, here are two images of the famous bell tower of La Torrassa:
|
|
76
|
+
|
|
77
|
+
\begin{center}
|
|
78
|
+
\includegraphics[width=3cm]{campanar}
|
|
79
|
+
\qquad
|
|
80
|
+
\includegraphics[width=5cm]{campanar}
|
|
81
|
+
\end{center}
|
|
82
|
+
|
|
83
|
+
Available formats are PNG, JPG, PDF, BMP and EPS. SVG is also supported in HTML but not in PDF. Prefer vector formats (PDF, EPS, SVG) whenever possible to ensure the best quality at any size, and use PNG or JPG only for raster and photographic images.
|
|
84
|
+
|
|
85
|
+
\medskip
|
|
86
|
+
|
|
87
|
+
Use conditional rendering to include different images depending on the output format:
|
|
88
|
+
|
|
89
|
+
\begin{center}
|
|
90
|
+
\begin{latexonly}
|
|
91
|
+
\includegraphics[width=3cm]{jutge.png}
|
|
92
|
+
\end{latexonly}
|
|
93
|
+
\begin{htmlonly}
|
|
94
|
+
\includegraphics[width=3cm]{jutge.svg}
|
|
95
|
+
\end{htmlonly}
|
|
96
|
+
\end{center}
|
|
97
|
+
|
|
98
|
+
In the HTML version, figures will be embedded in the document, ensuring compatibility across different browsers without relying on external files. In the Text and Markdown versions of the statement, images will be represented by their filenames enclosed in square brackets. Unfortunately, Pandoc does not honor alignment of images.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
\paragraph{Code.}
|
|
102
|
+
|
|
103
|
+
Code snippets can be included using the \textbf{listings} package. Here is a simple Python code example:
|
|
104
|
+
|
|
105
|
+
\begin{lstlisting}[language=Python, xleftmargin=0.75cm]
|
|
106
|
+
import yogi
|
|
107
|
+
|
|
108
|
+
a = yogi.read(int)
|
|
109
|
+
b = yogi.read(int)
|
|
110
|
+
print(a + b)
|
|
111
|
+
\end{lstlisting}
|
|
112
|
+
|
|
113
|
+
and here is a C++ code example:
|
|
114
|
+
|
|
115
|
+
\begin{lstlisting}[language=C++, xleftmargin=0.75cm]
|
|
116
|
+
#include <iostream>
|
|
117
|
+
using namespace std;
|
|
118
|
+
|
|
119
|
+
int main() {
|
|
120
|
+
int a, b;
|
|
121
|
+
cin >> a >> b;
|
|
122
|
+
cout << a + b << endl;
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
\end{lstlisting}
|
|
126
|
+
|
|
127
|
+
The listings package supports many programming languages and produces nicely formatted code both in PDF and HTML statements.
|
|
128
|
+
|
|
129
|
+
\medskip
|
|
130
|
+
|
|
131
|
+
\lstset{language=C++}
|
|
132
|
+
Code snippets can also be included inline: \lstinline|if (found) cout << pos;|.
|
|
133
|
+
In this case, it was necessary to use \verb|\lstset{language=C++}| to set the language.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
\paragraph{Inline code deprecations.}
|
|
137
|
+
|
|
138
|
+
The former use of at signs (@) and vertical bars (|) to include inline code snippets is deprecated because \textbf{pandoc} does not support it and introduced conflicts with other packages. You will have to replace them with \verb|\lstinline| or with \verb|\verb|| as shown above. Statements with at signs for inline listings can be automatically converted using \texttt{jtk convert transform-at-signs}.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
\paragraph{Hyperlinks.}
|
|
142
|
+
|
|
143
|
+
Hyperlinks can be included in the statement using the \textbf{hyperref} package.
|
|
144
|
+
For example, visit \href{https://jutge.org}{Jutge.org} for more information.
|
|
145
|
+
In the PDF and HTML versions, the link will be clickable, in the Markdown version, the URL will be displayed as required, but the Text version will only show the link text (Why? Can we fix it?).
|
|
146
|
+
|
|
147
|
+
\medskip
|
|
148
|
+
In addition, the \verb|Link| macro is provided to include links to other Jutge.org problems:
|
|
149
|
+
See the Hello World problem \Link{P68688}. Adding the language suffix is not recommended.
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
\paragraph{Colors.}
|
|
153
|
+
|
|
154
|
+
Colors can be used in the statement using the \textbf{color} package.
|
|
155
|
+
For instance, \textcolor{red}{this text is red}, \textcolor{blue}{this text is blue}, and \textcolor{green}{this text is green}.
|
|
156
|
+
Of course, colors are not supported in the Text and Markdown versions of the statement.
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
\paragraph{Columns.}
|
|
160
|
+
|
|
161
|
+
The statement can also include multiple columns using the \textbf{multicol} package.
|
|
162
|
+
Here is an example with two columns:
|
|
163
|
+
|
|
164
|
+
\begin{multicols}{2}
|
|
165
|
+
|
|
166
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
|
167
|
+
|
|
168
|
+
\end{multicols}
|
|
169
|
+
|
|
170
|
+
This is shown in the PDF version only, as multiple columns are not supported in HTML, Text, or Markdown.
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
\paragraph{PS Tricks.}
|
|
174
|
+
|
|
175
|
+
PS Tricks figures can also be included in the statement but this is discouraged as it is not supported in HTML. Here is a simple example:
|
|
176
|
+
|
|
177
|
+
\begin{center}
|
|
178
|
+
\begin{pspicture}(0,0)(2,2)
|
|
179
|
+
\psline{->}(0,0)(2,2)
|
|
180
|
+
\pscircle(1,1){1}
|
|
181
|
+
\end{pspicture}
|
|
182
|
+
\end{center}
|
|
183
|
+
|
|
184
|
+
\paragraph{Tikz.}
|
|
185
|
+
|
|
186
|
+
Tikz figures can also be included in the statement but this is discouraged as it is not supported in HTML. Here is a simple example:
|
|
187
|
+
|
|
188
|
+
\begin{center}
|
|
189
|
+
\begin{tikzpicture}
|
|
190
|
+
\draw[->] (0,0) -- (2,2);
|
|
191
|
+
\draw (1,1) circle (1cm);
|
|
192
|
+
\end{tikzpicture}
|
|
193
|
+
\end{center}
|
|
194
|
+
|
|
195
|
+
\paragraph{Chessboards.}
|
|
196
|
+
|
|
197
|
+
Chessboards can also be drawn in the statement using the \texttt{chessboard} package but this is discouraged as they are not supported in HTML.
|
|
198
|
+
|
|
199
|
+
\begin{center}
|
|
200
|
+
\chessboard[setpieces={Ke1, Qd1, Ra1, Rh1, Bc1, Bf1, Nb1, Ng1,
|
|
201
|
+
ke8, qd8, ra8, rh8, bc8, bf8, nb8, ng8},
|
|
202
|
+
showmover=false]
|
|
203
|
+
\end{center}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
\Input
|
|
208
|
+
|
|
209
|
+
The Input section describes the format of the input data that your program will receive.
|
|
210
|
+
|
|
211
|
+
\Output
|
|
212
|
+
|
|
213
|
+
The Output section describes the format of the output data that your program must produce.
|
|
214
|
+
|
|
215
|
+
\Observation
|
|
216
|
+
|
|
217
|
+
There are a bunch of sectioning macros that can be used to include additional information in the statement:
|
|
218
|
+
|
|
219
|
+
\begin{itemize*}
|
|
220
|
+
\item \verb|\Observation|
|
|
221
|
+
\item \verb|\Observations|
|
|
222
|
+
\item \verb|\Example|
|
|
223
|
+
\item \verb|\Precondition|
|
|
224
|
+
\item \verb|\Scoring|
|
|
225
|
+
\item \verb|\Scores|
|
|
226
|
+
\item \verb|\Hint|
|
|
227
|
+
\item \verb|\Interface|
|
|
228
|
+
\item \verb|\ObservationElastic|
|
|
229
|
+
\item \verb|\ObservationElasticII|
|
|
230
|
+
\item \verb|\ObservationNoMain|
|
|
231
|
+
\item \verb|\Solution|
|
|
232
|
+
\end{itemize*}
|
|
233
|
+
|
|
234
|
+
These are localized automatically depending on the language of the problem.
|
|
235
|
+
|
|
236
|
+
\medskip
|
|
237
|
+
|
|
238
|
+
The following macros configure the listings package used to display code snippets according to the some programming languages:
|
|
239
|
+
|
|
240
|
+
\begin{itemize*}
|
|
241
|
+
\item \verb|\UseCPP|
|
|
242
|
+
\item \verb|\UsePython|
|
|
243
|
+
\item \verb|\UseHaskell|
|
|
244
|
+
\item \verb|\UseClojure|
|
|
245
|
+
\end{itemize*}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
\medskip
|
|
249
|
+
|
|
250
|
+
Interface macros are provided to describe possible interfaces that depend on the programming language used (we plan to improve this in the future):
|
|
251
|
+
|
|
252
|
+
\Interface
|
|
253
|
+
\begin{tabular}{rl}
|
|
254
|
+
C++ &
|
|
255
|
+
\begin{lstlisting}[language=C++]
|
|
256
|
+
int factorial(int n);
|
|
257
|
+
\end{lstlisting}
|
|
258
|
+
\\
|
|
259
|
+
C &
|
|
260
|
+
\begin{lstlisting}[language=C]
|
|
261
|
+
int factorial(int n);
|
|
262
|
+
\end{lstlisting}
|
|
263
|
+
\\
|
|
264
|
+
Java &
|
|
265
|
+
\begin{lstlisting}[language=Java]
|
|
266
|
+
public static int factorial(int n);
|
|
267
|
+
\end{lstlisting}
|
|
268
|
+
\\
|
|
269
|
+
Python &
|
|
270
|
+
\begin{lstlisting}[language=Python]
|
|
271
|
+
factorial(n) # returns int
|
|
272
|
+
\end{lstlisting}
|
|
273
|
+
\\
|
|
274
|
+
&
|
|
275
|
+
\begin{lstlisting}[language=Python]
|
|
276
|
+
factorial(n: int) -> int
|
|
277
|
+
\end{lstlisting}
|
|
278
|
+
\end{tabular}
|
|
279
|
+
|
|
280
|
+
\bigskip
|
|
281
|
+
|
|
282
|
+
Scoring macros are provided to describe how the problem will be scored (you also need to provide a matching \texttt{scores.yml} file!):
|
|
283
|
+
|
|
284
|
+
\Scoring
|
|
285
|
+
|
|
286
|
+
\Score{Case A}{20}{Easy inputs.}
|
|
287
|
+
\Score{Case B}{30}{Medium inputs.}
|
|
288
|
+
\Score{Case C}{50}{Hard inputs.}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
\medskip
|
|
292
|
+
|
|
293
|
+
Macros for including sample inputs and outputs are also provided:
|
|
294
|
+
|
|
295
|
+
\begin{itemize*}
|
|
296
|
+
\item \verb|\Sample|
|
|
297
|
+
\item \verb|\SampleOneCol|
|
|
298
|
+
\item \verb|\SampleTwoCol|
|
|
299
|
+
\item \verb|\SampleSession|
|
|
300
|
+
\end{itemize*}
|
|
301
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2 3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
15 27
|
|
@@ -1,48 +1,53 @@
|
|
|
1
|
-
% \usepackage{html}
|
|
2
|
-
|
|
3
|
-
% added for xelatex
|
|
4
|
-
\usepackage{fontspec}
|
|
5
|
-
\setmainfont{texgyrepagella-regular.otf}[
|
|
6
|
-
BoldFont=texgyrepagella-bold.otf,
|
|
7
|
-
ItalicFont=texgyrepagella-italic.otf,
|
|
8
|
-
BoldItalicFont=texgyrepagella-bolditalic.otf
|
|
9
|
-
]
|
|
10
|
-
\setsansfont{texgyreheros-regular.otf}[
|
|
11
|
-
BoldFont=texgyreheros-bold.otf,
|
|
12
|
-
ItalicFont=texgyreheros-italic.otf,
|
|
13
|
-
BoldItalicFont=texgyreheros-bolditalic.otf
|
|
14
|
-
]
|
|
15
|
-
\setmonofont{texgyrecursor-regular.otf}[
|
|
16
|
-
BoldFont=texgyrecursor-bold.otf,
|
|
17
|
-
ItalicFont=texgyrecursor-italic.otf,
|
|
18
|
-
BoldItalicFont=texgyrecursor-bolditalic.otf
|
|
19
|
-
]
|
|
20
|
-
|
|
21
1
|
%remove for xelatex
|
|
22
2
|
%\usepackage{mathpazo}
|
|
23
3
|
%\usepackage{helvet}
|
|
24
4
|
%\usepackage{courier}
|
|
25
5
|
|
|
6
|
+
\usepackage{hyperref}
|
|
7
|
+
\usepackage{graphicx}
|
|
8
|
+
\usepackage{moreverb} % for verbatimtabinput
|
|
26
9
|
\usepackage{mdwlist}
|
|
27
|
-
\usepackage{shortvrb}
|
|
28
10
|
\usepackage{picins}
|
|
29
11
|
\usepackage{pstricks}
|
|
30
12
|
\usepackage{pst-tree}
|
|
31
13
|
\usepackage{graphicx}
|
|
32
14
|
\usepackage{amsmath}
|
|
33
15
|
\usepackage{geometry}
|
|
34
|
-
\usepackage{moreverb}
|
|
35
16
|
\usepackage{multicol}
|
|
36
17
|
%\usepackage[utf8]{inputenc} %remove for xelatex
|
|
37
18
|
\usepackage{listings}
|
|
38
19
|
\usepackage{textcomp}
|
|
39
20
|
\usepackage{chessboard}
|
|
40
21
|
\usepackage{tikz}
|
|
41
|
-
|
|
42
|
-
\usepackage{eurosym}
|
|
22
|
+
%\usepackage{wasysym} % remove because not used
|
|
43
23
|
\usepackage{color}
|
|
44
24
|
|
|
45
25
|
|
|
26
|
+
% added for xelatex
|
|
27
|
+
\usepackage{fontspec}
|
|
28
|
+
\setmainfont{texgyrepagella-regular.otf}[
|
|
29
|
+
BoldFont=texgyrepagella-bold.otf,
|
|
30
|
+
ItalicFont=texgyrepagella-italic.otf,
|
|
31
|
+
BoldItalicFont=texgyrepagella-bolditalic.otf
|
|
32
|
+
]
|
|
33
|
+
\setsansfont{texgyreheros-regular.otf}[
|
|
34
|
+
BoldFont=texgyreheros-bold.otf,
|
|
35
|
+
ItalicFont=texgyreheros-italic.otf,
|
|
36
|
+
BoldItalicFont=texgyreheros-bolditalic.otf
|
|
37
|
+
]
|
|
38
|
+
\setmonofont{texgyrecursor-regular.otf}[
|
|
39
|
+
BoldFont=texgyrecursor-bold.otf,
|
|
40
|
+
ItalicFont=texgyrecursor-italic.otf,
|
|
41
|
+
BoldItalicFont=texgyrecursor-bolditalic.otf
|
|
42
|
+
]
|
|
43
|
+
\usepackage{unicode-math}
|
|
44
|
+
\setmainfont{texgyrepagella-regular.otf}[
|
|
45
|
+
BoldFont=texgyrepagella-bold.otf,
|
|
46
|
+
ItalicFont=texgyrepagella-italic.otf,
|
|
47
|
+
BoldItalicFont=texgyrepagella-bolditalic.otf
|
|
48
|
+
]
|
|
49
|
+
\setmathfont{texgyrepagella-math.otf}
|
|
50
|
+
|
|
46
51
|
|
|
47
52
|
\geometry{
|
|
48
53
|
a4paper,twoside,
|
|
@@ -54,10 +59,6 @@
|
|
|
54
59
|
\setlength{\parindent}{0cm}
|
|
55
60
|
\pagestyle{empty}
|
|
56
61
|
|
|
57
|
-
\MakeShortVerb\|
|
|
58
|
-
|
|
59
|
-
\newenvironment{NoShortVerb}{\DeleteShortVerb\|}{\MakeShortVerb\|}
|
|
60
|
-
|
|
61
62
|
|
|
62
63
|
\newcommand{\mysection}[1]{\subsection*{#1}}
|
|
63
64
|
|
|
@@ -273,9 +274,7 @@
|
|
|
273
274
|
\newcommand{\uq}[1]{\texttt{\small #1}}
|
|
274
275
|
|
|
275
276
|
|
|
276
|
-
\providecommand{\Link}[1]{
|
|
277
|
-
\texttt{#1} % TODO: hyperlink
|
|
278
|
-
}
|
|
277
|
+
\providecommand{\Link}[1]{\href{https://jutge.org/problems/#1}{\textbf{#1}}}
|
|
279
278
|
|
|
280
279
|
|
|
281
280
|
|
|
@@ -284,9 +283,7 @@
|
|
|
284
283
|
|
|
285
284
|
\lstset{language=C++}
|
|
286
285
|
\lstset{columns=flexible}
|
|
287
|
-
%\lstset{basewidth={1em,1em}}
|
|
288
286
|
\lstset{keepspaces=true}
|
|
289
|
-
\lstset{morekeywords={string,include,cin,cout,endl}}
|
|
290
287
|
\lstset{stringstyle=\ttfamily}
|
|
291
288
|
\lstset{commentstyle={}}
|
|
292
289
|
\lstset{numberstyle=\tiny\sffamily}
|
|
@@ -296,14 +293,12 @@
|
|
|
296
293
|
\lstset{showstringspaces=false}
|
|
297
294
|
\lstset{upquote=true}
|
|
298
295
|
\lstset{texcl=true}
|
|
299
|
-
\lstset{literate={->}{$\rightarrow$}1 {<=}{$\le$}1 {>=}{$\ge$}1 {!=}{$\neq$}1 {<<}{$<\!\!\!<$}2 {>>}{$>\!\!\!>$}2}
|
|
300
|
-
\lstset{xleftmargin=0.25cm}
|
|
301
|
-
|
|
302
|
-
%\lstMakeShortInline@ Aquesta comanda el principal, perquè aquí hem potinejat les @,
|
|
303
|
-
|
|
304
296
|
|
|
305
297
|
\renewcommand{\footnote}[1]{ (#1)}
|
|
306
298
|
|
|
299
|
+
% for backward compatibility but deprecated
|
|
300
|
+
\providecommand{\CPP}{C++}
|
|
301
|
+
|
|
307
302
|
\newcommand{\UseHaskell}{
|
|
308
303
|
\lstset{language=Haskell}
|
|
309
304
|
\lstset{columns=fullflexible}
|
|
@@ -318,5 +313,12 @@
|
|
|
318
313
|
\newcommand{\UsePython}{
|
|
319
314
|
\lstset{language=Python}
|
|
320
315
|
\lstset{columns=fullflexible}
|
|
316
|
+
\lstset{literate={<=}{$\le$}1 {>=}{$\ge$}1 {/=}{$\neq$}1 {->}{$\rightarrow$}1 {=>}{$\Rightarrow$}1}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
\newcommand{\UseCPP}{
|
|
320
|
+
\lstset{language=CPP}
|
|
321
|
+
\lstset{columns=fullflexible}
|
|
322
|
+
\lstset{literate={<=}{$\le$}1 {>=}{$\ge$}1 {/=}{$\neq$}1 {->}{$\rightarrow$}1 {=>}{$\Rightarrow$}1}
|
|
321
323
|
}
|
|
322
324
|
|