Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 42 additions & 8 deletions problemtools/templates/latex/problemset.cls
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@
\newcommand*{\statementdirectory}[1]{\def\@statementdirectory{#1}}
\newcommand*{\statementfilename}[1]{\def\@statementfilename{#1}}
\newcommand*{\problemparentpath}[1]{\def\@problemparentpath{#1}}
% \problemlanguge is solely for backwards compatibility on the off chance someone external uses problemset.cls. Probably not needed
\newcommand*{\problemlanguage}[1]{\def\@problemlanguage{#1}\statementfilename{problem#1.tex}}
\newcommand*{\problemlanguage}[1]{%
\statementfilename{problem#1.tex}%
\setproblemlanguagestrings{#1}%
}
\contestname{}
\contestshortname{}
\contestlogo{}
Expand All @@ -92,7 +94,6 @@
\statementdirectory{problem_statement} % Default to the old standard directory on the off chance someone external uses problemset.cls
\statementfilename{}
\problemparentpath{}
\problemlanguage{}

\newcommand{\@problempath}[1]{\ifx\@problemparentpath\@empty#1\else\@problemparentpath/#1\fi}

Expand Down Expand Up @@ -250,11 +251,44 @@

%% Commands related to sample data

\newcommand{\sampleinputname}{Sample Input}
\newcommand{\sampleoutputname}{Sample Output}
\newcommand{\sampleinteractname}{Sample Interaction}
\newcommand{\sampleinteractreadname}{Read}
\newcommand{\sampleinteractwritename}{Write}
% --- Translations ---
% English (default)
\newcommand{\@translation@en@sampleinputname}{Sample Input}
\newcommand{\@translation@en@sampleoutputname}{Sample Output}
\newcommand{\@translation@en@sampleinteractname}{Sample Interaction}
\newcommand{\@translation@en@sampleinteractreadname}{Read}
\newcommand{\@translation@en@sampleinteractwritename}{Write}

% Swedish
\newcommand{\@translation@sv@sampleinputname}{Exempel på indata}
\newcommand{\@translation@sv@sampleoutputname}{Exempel på utdata}
\newcommand{\@translation@sv@sampleinteractname}{Exempel på interaktion}
\newcommand{\@translation@sv@sampleinteractreadname}{Läs}
\newcommand{\@translation@sv@sampleinteractwritename}{Skriv}

% Icelandic
\newcommand{\@translation@is@sampleinputname}{Sýniinntak}
\newcommand{\@translation@is@sampleoutputname}{Sýniúttak}
\newcommand{\@translation@is@sampleinteractname}{Sýnisamskipti}
\newcommand{\@translation@is@sampleinteractreadname}{Lestur}
\newcommand{\@translation@is@sampleinteractwritename}{Skrif}
% --- End Translations ---

\newcommand{\setproblemlanguagestrings}[1]{%
\expandafter\ifx\csname @translation@#1@sampleinputname\endcsname\relax
% Language not found, default to English
\def\problemlanguageis{en}%
\else
% Language found
\def\problemlanguageis{#1}%
\fi
\expandafter\let\expandafter\sampleinputname\csname @translation@\problemlanguageis @sampleinputname\endcsname
\expandafter\let\expandafter\sampleoutputname\csname @translation@\problemlanguageis @sampleoutputname\endcsname
\expandafter\let\expandafter\sampleinteractname\csname @translation@\problemlanguageis @sampleinteractname\endcsname
\expandafter\let\expandafter\sampleinteractreadname\csname @translation@\problemlanguageis @sampleinteractreadname\endcsname
\expandafter\let\expandafter\sampleinteractwritename\csname @translation@\problemlanguageis @sampleinteractwritename\endcsname
}
\setproblemlanguagestrings{en}

\newcommand{\formatsampleheader}[1]{\textsf{\textbf{#1}}}

Expand Down
2 changes: 1 addition & 1 deletion problemtools/templates/latex/template.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\documentclass[plainproblems,noautoincludesamples]{problemset}

%% If you want to add comments in this file, you need to use %%, as it must be compatible with python's templates
\problemlanguage{%(language)s} %% We inject problemlanguage to be backwards compatible with custom problemset.cls
\problemlanguage{%(language)s}
\problemparentpath{%(problemparent)s}
\statementdirectory{%(statement_directory)s}
\statementfilename{%(statement_filename)s}
Expand Down