7

PdfTeX has \pdfmdfivesum{...} and \pdfmdfivesum file {...} for inline text and external file content, respectively.

On the other hand, XeTeX seems to provide only \mdfivesum. Is there a means to calculate the md5sum of files in XeTeX?

\documentclass{article}
\usepackage{ifxetex}

\begin{document}

%for text
\ifxetex
  \mdfivesum{Hello World!}
\else
  \pdfmdfivesum{Hello World!}
\fi

%for file (content)
\ifxetex
  %% ??? \filemdfivesum{\jobname.tex} ??? %%
\else
  \pdfmdfivesum file {\jobname.tex}
\fi

\end{document}
7

The syntax uses file as in pdftex,

\documentclass{article}
\usepackage{ifxetex}

\begin{document}

%for text
\ifxetex
  \mdfivesum{Hello World!}
\else
  \pdfmdfivesum{Hello World!}
\fi

%for file (content)
\ifxetex
  \mdfivesum file {\jobname.tex}
  \typeout{ xetex \mdfivesum file {\jobname.tex}}
\else
  \pdfmdfivesum file {\jobname.tex}
  \typeout{pdftex \pdfmdfivesum file {\jobname.tex}}
\fi


\end{document}

Produces (in texlive 2016 at least) a log of

$ xelatex qq184
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./qq184.tex
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
(/usr/local/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(./qq184.aux)
 xetex 886540D667C448267B1AC7A23BF6DB36
[1] (./qq184.aux) )
Output written on qq184.pdf (1 page).
Transcript written on qq184.log.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.