Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Created March 21, 2018 15:00
Show Gist options
  • Select an option

  • Save wtsnjp/8248c01769bbeeb21f383b5a1b423fd8 to your computer and use it in GitHub Desktop.

Select an option

Save wtsnjp/8248c01769bbeeb21f383b5a1b423fd8 to your computer and use it in GitHub Desktop.
\makeatletter
\newif\if@wrong\@wrongtrue
\def\CheckAnswer#1{%
\def\x@ans{E394D353A8067671DDDEC726F1D054C8}%
\let\x@tmpa\@empty
\expandafter\@tfor\expandafter\@char\expandafter:\expandafter=\x@ans
\do{\xdef\x@tmpa{\expandafter\x@tmpa\expandafter\string\@char}}%
\xdef\x@tmpb{\pdfmdfivesum{#1}}%
\ifx\x@tmpa\x@tmpb\relax
\@wrongfalse
\typeout{Congratulations!!}%
\@@end
\else
\typeout{Think again :(}%
\fi}
\def\x@chop#1 {#1}
\@whilesw\if@wrong\fi{%
\read16 to \YourAnswer
\xdef\x@tmpa{\expandafter\x@chop\YourAnswer}%
\expandafter\CheckAnswer\expandafter{\x@tmpa}}
\makeatother
% vim: set ft=plaintex:
@wtsnjp
Copy link
Author

wtsnjp commented Mar 21, 2018

初級者向け LaTeX実力テスト ~キホン編~ の答え合わせ

Usage: (pdf)latex checkanswer.tex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment