1

I'd like to make QR-Codes with the package qrcode. The QR-Code shall include the output of a different command (from the package latexgit) instead of static text. How can this be done?

Minimal Example: Generate a QR-Code with the the current commit-ID inside a Git-Repository:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{qrcode}
\usepackage{latexgit} % typeset with "pdflatex --shell-escape <filename.tex>. Add and commit before typesetting!

\begin{document}
This is some text …

Short commit-ID as text: \gitcommithash % Print short commit-ID, from package latexgit    

A "static" QR-Code: % This works with qrcode-package:

\qrcode[height=1cm]{This is static text.}

A QR-Code with output of different command -- this fails typsetting:

% This fails typesetting -- help!}
\qrcode[height=1cm]{\gitcommithash} % Make a QR-Code with commit-ID.

How can this be made working?
\end{document}
  • 2
    Since \gitcommithash is not expandable this might turn out to be hard. Maybe a two run solution is possible, but I don't have the time right now to try things. – Skillmon Sep 26 '18 at 14:47
  • Not expert with Git, but as far as I can see the code to print is saved in \git@rawresult, so you could try \begingroup\edef\x{\endgroup\noexpand\qrcode[height=1cm]{\csname git@rawresult\endcsname}\x – egreg Sep 26 '18 at 14:59
  • Thank you! But inserting your, egreg, snippet does not work, too. pdflatex complains about an "Undefined control sequence" and no PDF ist produced :-( – user171217 Sep 29 '18 at 21:09

Your Answer

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

Browse other questions tagged or ask your own question.