Core: add pre-commit and run it on all files

This commit is contained in:
Bertrand Benjamin 2022-08-21 09:12:40 +02:00
parent e119ea87f6
commit 0cc34422fe
32 changed files with 166 additions and 164 deletions

15
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/rstcheck/rstcheck
rev: 'v6.1.0' # Use the sha / tag you want to point at
hooks:
- id: rstcheck

View File

@ -75,9 +75,9 @@ Les balises doivent être bien imbriquée. C'est à dire qu'il faut fermer la de
\begin{lstlisting} \begin{lstlisting}
<div> <div>
Conversation Conversation
<p> <p>
Bonjour Bonjour
</p> </p>
</div> </div>
\end{lstlisting} \end{lstlisting}
@ -86,10 +86,10 @@ Les balises doivent être bien imbriquée. C'est à dire qu'il faut fermer la de
\begin{lstlisting} \begin{lstlisting}
<div> <div>
Conversation Conversation
<p> <p>
Bonjour Bonjour
</div> </div>
</p> </p>
\end{lstlisting} \end{lstlisting}
\end{multicols} \end{multicols}
@ -97,7 +97,7 @@ Les balises doivent être bien imbriquée. C'est à dire qu'il faut fermer la de
\subsection*{Validation} \subsection*{Validation}
Même si le rendu d'une page web peut sembler correcte, cela ne signifie pas que le code respecte les normes du HTML. En effet, les navigateurs sont en général très permissifs sur la qualité du code qui leur est fourni. Même si le rendu d'une page web peut sembler correcte, cela ne signifie pas que le code respecte les normes du HTML. En effet, les navigateurs sont en général très permissifs sur la qualité du code qui leur est fourni.
Ces normes sont définis pas le W3C (World Wide Web Consortium). Cet organisme propose un validateur: Ces normes sont définis pas le W3C (World Wide Web Consortium). Cet organisme propose un validateur:
\begin{center} \begin{center}

View File

@ -1,4 +1,4 @@
% ---- HTML % ---- HTML
\begin{exercise}[subtitle={Modifier une page HTML}, step={1}, origin={Ma tête}, topics={ Web HTML}, tags={ Web }] \begin{exercise}[subtitle={Modifier une page HTML}, step={1}, origin={Ma tête}, topics={ Web HTML}, tags={ Web }]
\begin{enumerate} \begin{enumerate}
\item Copier puis modifier le code de \texttt{page\_balises.html} pour qu'elle ressemble au document pdf à coté. \item Copier puis modifier le code de \texttt{page\_balises.html} pour qu'elle ressemble au document pdf à coté.
@ -14,7 +14,7 @@
\item liens 1 et 2 \item liens 1 et 2
\item listes \item listes
\item images \item images
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\end{exercise} \end{exercise}
@ -30,7 +30,7 @@
La page \texttt{page\_non\_valide.html} ne passe pas la validation W3C. À vous de la corriger pour que le rendu reste identique et qu'elle passe le test de validation. La page \texttt{page\_non\_valide.html} ne passe pas la validation W3C. À vous de la corriger pour que le rendu reste identique et qu'elle passe le test de validation.
\end{exercise} \end{exercise}
% ---- CSS % ---- CSS
\begin{exercise}[subtitle={Modifier une feuille de style CSS}, step={2}, origin={Ma tête}, topics={ Web CSS}, tags={ Web }] \begin{exercise}[subtitle={Modifier une feuille de style CSS}, step={2}, origin={Ma tête}, topics={ Web CSS}, tags={ Web }]
\begin{enumerate} \begin{enumerate}
\item Copier tous les fichiers du dossier \texttt{page\_CSS} puis modifier uniquement le fichier \texttt{style.css} pour que la page ressemble au rendu du pdf. \item Copier tous les fichiers du dossier \texttt{page\_CSS} puis modifier uniquement le fichier \texttt{style.css} pour que la page ressemble au rendu du pdf.

View File

@ -55,7 +55,7 @@
<footer> <footer>
<hr> <hr>
<p>Pied de page. Merci d'avoir lu</p> <p>Pied de page. Merci d'avoir lu</p>
</footer> </footer>
</body> </body>

View File

@ -56,7 +56,7 @@
<footer> <footer>
<hr> <hr>
<p>Pied de page. Merci d'avoir lu</p> <p>Pied de page. Merci d'avoir lu</p>
</footer> </footer>
</body> </body>

View File

@ -56,7 +56,7 @@
<footer> <footer>
<hr> <hr>
<p>Pied de page. Merci d'avoir lu</p> <p>Pied de page. Merci d'avoir lu</p>
</footer> </footer>
</body> </body>

View File

@ -56,7 +56,7 @@
<footer> <footer>
<hr> <hr>
<p>Pied de page. Merci d'avoir lu</p> <p>Pied de page. Merci d'avoir lu</p>
</footer> </footer>
</body> </body>

View File

@ -4,7 +4,7 @@ Divers
:date: 2022-08-21 :date: 2022-08-21
:modified: 2022-08-21 :modified: 2022-08-21
:authors: Benjamin Bertrand :authors: Benjamin Bertrand
:tags: :tags:
:category: 1ST :category: 1ST
:summary: Four tout pour les 1ST :summary: Four tout pour les 1ST

View File

@ -1,7 +1,7 @@
% Tableaux croisés % Tableaux croisés
\begin{exercise}[subtitle={Ventes du moi de janvier}, step={1}, origin={Ma tête}, topics={ Croisement de deux variables }, tags={ Statistiques}, mode={\searchMode}] \begin{exercise}[subtitle={Ventes du moi de janvier}, step={1}, origin={Ma tête}, topics={ Croisement de deux variables }, tags={ Statistiques}, mode={\searchMode}]
Sur le document "vente du mois de janvier", on a recueillit les données de vente de plusieurs commerciaux d'une entreprise. Sur le document "vente du mois de janvier", on a recueillit les données de vente de plusieurs commerciaux d'une entreprise.
\begin{multicols}{2} \begin{multicols}{2}
\begin{enumerate} \begin{enumerate}
\item Combien de ventes ont été réalisées par Trantow? \item Combien de ventes ont été réalisées par Trantow?
@ -23,7 +23,7 @@
\item Questions du type 1 et 2 \item Questions du type 1 et 2
\item Questions du type 3 et 4 \item Questions du type 3 et 4
\item Questions du type 5 à 7 \item Questions du type 5 à 7
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
Proposer un tableau qui permet de répondre aux questions 1 à 7 sans avoir à faire de calculs. Proposer un tableau qui permet de répondre aux questions 1 à 7 sans avoir à faire de calculs.
\end{exercise} \end{exercise}
@ -194,9 +194,6 @@
\item Parmi les filles, quel est le pourcentage de diplômées d'un CAP? \item Parmi les filles, quel est le pourcentage de diplômées d'un CAP?
\item Quelle est la proportion de garçons parmi les diplômés du DNB? \item Quelle est la proportion de garçons parmi les diplômés du DNB?
\end{enumerate} \end{enumerate}
\end{enumerate} \end{enumerate}
\end{minipage} \end{minipage}
\end{exercise} \end{exercise}

View File

@ -11,22 +11,22 @@ Croisement de deux variables
Programme Programme
========= =========
Contenus Contenus
--------- ---------
- Tableau croisé deffectifs. - Tableau croisé deffectifs.
- Fréquence conditionnelle, fréquence marginale. - Fréquence conditionnelle, fréquence marginale.
Capacités attendues Capacités attendues
-------------------- --------------------
- Calculer des fréquences conditionnelles et des fréquences marginales. - Calculer des fréquences conditionnelles et des fréquences marginales.
- Compléter un tableau croisé par des raisonnements sur les effectifs ou en utilisant des fréquences conditionnelles. - Compléter un tableau croisé par des raisonnements sur les effectifs ou en utilisant des fréquences conditionnelles.
Commentaires Commentaires
------------- -------------
- Létude des fréquences conditionnelles permet un travail sur la langue française en considérant les formulations usuellement utilisées dans les médias. - Létude des fréquences conditionnelles permet un travail sur la langue française en considérant les formulations usuellement utilisées dans les médias.
- Des variables catégorielles de natures diverses sont étudiées: nominale (profession, espèce, département de résidence…), ordinale (niveau détude, degré de satisfaction de la clientèle…) ou définies par des intervalles (classe dâge, temps de transport…). - Des variables catégorielles de natures diverses sont étudiées: nominale (profession, espèce, département de résidence…), ordinale (niveau détude, degré de satisfaction de la clientèle…) ou définies par des intervalles (classe dâge, temps de transport…).
- Les élèves travaillent avec des données réelles dans des domaines variés (sécurité routière, démographie, économie, agronomie…). - Les élèves travaillent avec des données réelles dans des domaines variés (sécurité routière, démographie, économie, agronomie…).
- Au moins un traitement statistique de fichier de données individuelles anonymes est proposé, issu par exemple du web (OpenData…). - Au moins un traitement statistique de fichier de données individuelles anonymes est proposé, issu par exemple du web (OpenData…).
@ -34,7 +34,7 @@ Commentaires
Situations algorithmiques Situations algorithmiques
------------------------- -------------------------
- À partir de deux listes représentant deux caractères d'individus, déterminer un sous-ensemble d'individus répondant à un critère (filtre, utilisation des ET, OU, NON). - À partir de deux listes représentant deux caractères d'individus, déterminer un sous-ensemble d'individus répondant à un critère (filtre, utilisation des ET, OU, NON).
- Dresser le tableau croisé de deux variables catégorielles à partir du fichier des individus et calculer des fréquences conditionnelles ou marginales. - Dresser le tableau croisé de deux variables catégorielles à partir du fichier des individus et calculer des fréquences conditionnelles ou marginales.
Progression Progression
@ -57,5 +57,3 @@ On cherche à faire émerger la notion de tableau croisé. Pour cela on donne au
Étape 3: Fréquence conditionnelle et fréquence marginale Étape 3: Fréquence conditionnelle et fréquence marginale
-------------------------------------------------------- --------------------------------------------------------

View File

@ -23,8 +23,8 @@
Savoir-faire de la séquence Savoir-faire de la séquence
\begin{itemize} \begin{itemize}
\item Calculer, appliquer, exprimer une proportion sous différentes formes (décimale, fractionnaire, pourcentage) \item Calculer, appliquer, exprimer une proportion sous différentes formes (décimale, fractionnaire, pourcentage)
\item Calculer des fréquences conditionnelles et des fréquences marginales. \item Calculer des fréquences conditionnelles et des fréquences marginales.
\item Compléter un tableau croisé par des raisonnements sur les effectifs ou en utilisant des fréquences conditionnelles. \item Compléter un tableau croisé par des raisonnements sur les effectifs ou en utilisant des fréquences conditionnelles.
\end{itemize} \end{itemize}

View File

@ -34,4 +34,4 @@ rsync_cleUSB: clean
rsync -rtv -u $(COMMON_EXCLUDE) ../Productions\ Eleves/ /run/media/lafrite/$(CLEUSB)/Productions rsync -rtv -u $(COMMON_EXCLUDE) ../Productions\ Eleves/ /run/media/lafrite/$(CLEUSB)/Productions
.PHONY: .PHONY:

View File

@ -4,7 +4,7 @@ Divers
:date: 2022-08-21 :date: 2022-08-21
:modified: 2022-08-21 :modified: 2022-08-21
:authors: Benjamin Bertrand :authors: Benjamin Bertrand
:tags: :tags:
:category: SNT :category: SNT
:summary: Four tout pour la SNT :summary: Four tout pour la SNT

View File

@ -10,4 +10,3 @@ source ~/.venv/enseignements/bin/activate
goroot(){ goroot(){
cd $ROOT cd $ROOT
} }

Binary file not shown.

View File

@ -50,7 +50,7 @@
}, },
year label/.style={ year label/.style={
fill=white,text=darkgreen,font=\bfseries\Large fill=white,text=darkgreen,font=\bfseries\Large
}, },
current year/.store in=\currentyear, current year/.store in=\currentyear,
current year=2022, current year=2022,
next year/.store in=\nextyear, next year/.store in=\nextyear,
@ -63,7 +63,7 @@
row 7/.style={darkgreen,node distance=.3ex}, row 7/.style={darkgreen,node distance=.3ex},
column sep=1ex,% column sep=1ex,%
draw=darkgreen,thick,rounded corners=5pt,% draw=darkgreen,thick,rounded corners=5pt,%
append after command={ append after command={
\pgfextra{\edef\matrixname{\tikzlastnode}} \pgfextra{\edef\matrixname{\tikzlastnode}}
node [year label/.try, right=1ex of \matrixname.south west] {\nextyear} node [year label/.try, right=1ex of \matrixname.south west] {\nextyear}
node [year label/.try, right=1ex of \matrixname.north west] {\currentyear} node [year label/.try, right=1ex of \matrixname.north west] {\currentyear}
@ -86,7 +86,7 @@
}, },
year label/.style={ year label/.style={
fill=white,text=darkgreen,font=\bfseries\Large fill=white,text=darkgreen,font=\bfseries\Large
}, },
current year/.store in=\currentyear, current year/.store in=\currentyear,
current year=2023, current year=2023,
] ]
@ -97,7 +97,7 @@
row 7/.style={darkgreen,node distance=.3ex}, row 7/.style={darkgreen,node distance=.3ex},
column sep=1ex,% column sep=1ex,%
draw=darkgreen,thick,rounded corners=5pt,% draw=darkgreen,thick,rounded corners=5pt,%
append after command={ append after command={
\pgfextra{\edef\matrixname{\tikzlastnode}} \pgfextra{\edef\matrixname{\tikzlastnode}}
node [year label/.try, right=1ex of \matrixname.south west] {\currentyear} node [year label/.try, right=1ex of \matrixname.south west] {\currentyear}
node [year label/.try, right=1ex of \matrixname.north west] {\currentyear} node [year label/.try, right=1ex of \matrixname.north west] {\currentyear}

View File

@ -170,7 +170,7 @@
\begin{multicols}{2} \begin{multicols}{2}
\begin{verbatim} \begin{verbatim}
\begin{tikzpicture}[baseline=(current bounding box.south), \begin{tikzpicture}[baseline=(current bounding box.south),
xscale=1, yscale=0.5] xscale=1, yscale=0.5]
\tkzInit[xmin=-5,xmax=5,xstep=1, \tkzInit[xmin=-5,xmax=5,xstep=1,
ymin=-5,ymax=5,ystep=1] ymin=-5,ymax=5,ystep=1]
@ -182,7 +182,7 @@
\end{verbatim} \end{verbatim}
\columnbreak \columnbreak
\begin{tikzpicture}[baseline=(current bounding box.south), \begin{tikzpicture}[baseline=(current bounding box.south),
xscale=1, yscale=0.5] xscale=1, yscale=0.5]
\tkzInit[xmin=-5,xmax=5,xstep=1, \tkzInit[xmin=-5,xmax=5,xstep=1,
ymin=-5,ymax=5,ystep=1] ymin=-5,ymax=5,ystep=1]
@ -198,7 +198,7 @@ Quand on change la valeur de \verb+xstep+, il faut replacer \verb+x+ par \verb+\
\begin{multicols}{2} \begin{multicols}{2}
\begin{verbatim} \begin{verbatim}
\begin{tikzpicture}[baseline=(current bounding box.south), \begin{tikzpicture}[baseline=(current bounding box.south),
xscale=0.5, yscale=0.4] xscale=0.5, yscale=0.4]
\tkzInit[xmin=-5,xmax=5,xstep=0.5, \tkzInit[xmin=-5,xmax=5,xstep=0.5,
ymin=-5,ymax=5,ystep=1] ymin=-5,ymax=5,ystep=1]
@ -209,7 +209,7 @@ Quand on change la valeur de \verb+xstep+, il faut replacer \verb+x+ par \verb+\
\end{tikzpicture} \end{tikzpicture}
\end{verbatim} \end{verbatim}
\columnbreak \columnbreak
\begin{tikzpicture}[baseline=(current bounding box.south), \begin{tikzpicture}[baseline=(current bounding box.south),
xscale=0.5, yscale=0.4] xscale=0.5, yscale=0.4]
\tkzInit[xmin=-5,xmax=5,xstep=0.5, \tkzInit[xmin=-5,xmax=5,xstep=0.5,
ymin=-5,ymax=5,ystep=1] ymin=-5,ymax=5,ystep=1]
@ -257,4 +257,3 @@ Quand on change la valeur de \verb+xstep+, il faut replacer \verb+x+ par \verb+\
\end{document} \end{document}

View File

@ -5,7 +5,7 @@
\usepackage{tikz} \usepackage{tikz}
\usepackage{pgfplots} \usepackage{pgfplots}
\pgfplotsset{compat = newest} \pgfplotsset{compat = newest}
\usepgfplotslibrary{external} \usepgfplotslibrary{external}
\RequirePackage{tkz-tab} \RequirePackage{tkz-tab}
@ -35,7 +35,7 @@
% rectangle % rectangle
\draw (5, 0) rectangle (6, 6); \draw (5, 0) rectangle (6, 6);
\end{tikzpicture} \end{tikzpicture}
\section{Graphiques de fonctions} \section{Graphiques de fonctions}
@ -58,6 +58,6 @@
\begin{tikzpicture} \begin{tikzpicture}
\begin{axis}[axis x line=bottom,axis y line = left] \begin{axis}[axis x line=bottom,axis y line = left]
\addplot[ybar,fill=blue,draw=blue,bar width=1cm] coordinates { (1,194) (2,213) (3,251)(4,233) (5,194)}; \end{axis} \addplot[ybar,fill=blue,draw=blue,bar width=1cm] coordinates { (1,194) (2,213) (3,251)(4,233) (5,194)}; \end{axis}
\end{tikzpicture} \end{tikzpicture}
\end{document} \end{document}

View File

@ -67,4 +67,3 @@ export tribe=$tribe
export duration=$duration export duration=$duration
envsubst < ./tools/skeleton/eval/exercises.tex > $sequence_path/exercises.tex envsubst < ./tools/skeleton/eval/exercises.tex > $sequence_path/exercises.tex
envsubst < ./tools/skeleton/eval/sujet.tex > $sequence_path/sujet.tex envsubst < ./tools/skeleton/eval/sujet.tex > $sequence_path/sujet.tex

View File

@ -113,4 +113,3 @@ for i in `ls $SKELETONPATH/$sequence_type`
do do
envsubst < $SKELETONPATH/$sequence_type/$i > $sequence_path/$i envsubst < $SKELETONPATH/$sequence_type/$i > $sequence_path/$i
done done

View File

@ -20,8 +20,7 @@ Le barème est donné à titre indicatif, il pourra être modifié.
\printcollection{banque} \printcollection{banque}
\end{document} \end{document}
%%% Local Variables: %%% Local Variables:
%%% mode: latex %%% mode: latex
%%% TeX-master: "master" %%% TeX-master: "master"
%%% End: %%% End:

View File

@ -73,7 +73,7 @@
% Les tableaux % Les tableaux
\renewcommand{\arraystretch}{1.5} \renewcommand{\arraystretch}{1.5}
\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}} \newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}
% Figure qui se fondent dans le texte % Figure qui se fondent dans le texte
\RequirePackage{wrapfig} \RequirePackage{wrapfig}
@ -86,4 +86,3 @@
\RequirePackage{enumitem} \RequirePackage{enumitem}
\setlist[itemize,1]{label=$\bullet$} \setlist[itemize,1]{label=$\bullet$}

View File

@ -1,7 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesClass{classPres} \ProvidesClass{classPres}
% Classe de base - Beamer % Classe de base - Beamer
%\pdfminorversion=4 %\pdfminorversion=4
\LoadClassWithOptions{beamer} \LoadClassWithOptions{beamer}
@ -12,7 +12,7 @@
%\usefonttheme[onlymath]{serif} %\usefonttheme[onlymath]{serif}
% extensions % extensions
\RequirePackage{colorscheme} \RequirePackage{colorscheme}
\RequirePackage{base} \RequirePackage{base}
\geometry{left=10mm,right=10mm, top=0mm} \geometry{left=10mm,right=10mm, top=0mm}

View File

@ -18,7 +18,7 @@
{€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1 {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1
{»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1 {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1
} }
\lstset{ \lstset{
backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}; should come as last argument backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}; should come as last argument
%basicstyle=\tiny, % the size of the fonts that are used for the code %basicstyle=\tiny, % the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace

View File

@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
% Couleurs, % Couleurs,
\RequirePackage{xcolor} \RequirePackage{xcolor}

View File

@ -118,7 +118,7 @@
\GetExerciseProperty{subtitle}% \GetExerciseProperty{subtitle}%
{{\PropertyValue}}% {{\PropertyValue}}%
\dotfill \dotfill
%Auto-évaluation %Auto-évaluation
\begin{tikzpicture} \begin{tikzpicture}
\foreach \k in {0,1,...,4}{ \foreach \k in {0,1,...,4}{
\draw (\k*0.5, 0) node[draw, star, star points=5, star point ratio=0.5]{}; \draw (\k*0.5, 0) node[draw, star, star points=5, star point ratio=0.5]{};
@ -141,11 +141,10 @@
\newcommand\infoMode{\faIcon{desktop}} \newcommand\infoMode{\faIcon{desktop}}
\newcommand\legendMode{% \newcommand\legendMode{%
\textbf{Légende:} \hfill \textbf{Légende:} \hfill
\searchMode: pour découvrir quelque chose \searchMode: pour découvrir quelque chose
\hfill \hfill
\groupMode: à faire en groupe \groupMode: à faire en groupe
\hfill \hfill
\trainMode: pour s'entrainer \trainMode: pour s'entrainer
} }

View File

@ -1,6 +1,6 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
% extensions % extensions
\RequirePackage{colorscheme} \RequirePackage{colorscheme}
\RequirePackage{lastpage} \RequirePackage{lastpage}
@ -17,7 +17,7 @@
\newcommand{\duree}[1]{\renewcommand{\op@duree}{#1}} \newcommand{\duree}[1]{\renewcommand{\op@duree}{#1}}
\newcommand{\sujet}[1]{\renewcommand{\op@sujet}{Sujet #1}} \newcommand{\sujet}[1]{\renewcommand{\op@sujet}{Sujet #1}}
%% Redéfinition de maketitle %% Redéfinition de maketitle
\renewcommand{\maketitle}{% \renewcommand{\maketitle}{%
\noindent{\huge \color{title}\bfseries \@title}\par \noindent{\huge \color{title}\bfseries \@title}\par
\noindent{\color{line}\rule{\linewidth}{1ex}}\par \noindent{\color{line}\rule{\linewidth}{1ex}}\par
@ -32,7 +32,7 @@
\begin{center} \begin{center}
{\Huge \@title} \\ {\Huge \@title} \\
\vfill \vfill
{\Huge \op@tribe} \\ {\Huge \op@tribe} \\
\vfill \vfill
\fbox{ \fbox{

View File

@ -25,7 +25,7 @@
\qrcode{#2} \qrcode{#2}
\end{minipage} \end{minipage}
\begin{minipage}{0.8\linewidth} \begin{minipage}{0.8\linewidth}
\url{#2} \url{#2}
\end{minipage} \end{minipage}
}% }%

View File

@ -12,7 +12,7 @@
% version 2005/12/01 or later. % version 2005/12/01 or later.
% %
% This work has the LPPL maintenance status `maintained'. % This work has the LPPL maintenance status `maintained'.
% %
% The Current Maintainer of this work is Anders O.F. Hendrickson. % The Current Maintainer of this work is Anders O.F. Hendrickson.
% %
% This work consists of the files qrcode.dtx and qrcode.ins % This work consists of the files qrcode.dtx and qrcode.ins
@ -34,7 +34,7 @@
\documentclass{ltxdoc} \documentclass{ltxdoc}
\usepackage{hyperref} \usepackage{hyperref}
\usepackage[nolinks]{qrcode} \usepackage[nolinks]{qrcode}
\EnableCrossrefs \EnableCrossrefs
\CodelineIndex \CodelineIndex
\OnlyDescription \OnlyDescription
\RecordChanges \RecordChanges
@ -72,7 +72,7 @@
% \GetFileInfo{qrcode.sty} % \GetFileInfo{qrcode.sty}
% %
% \DoNotIndex{\newcommand,\newenvironment,\def} % \DoNotIndex{\newcommand,\newenvironment,\def}
% %
% \def\F{F} % \def\F{F}
% %
% \title{The \textsf{qrcode} package: \\ % \title{The \textsf{qrcode} package: \\
@ -93,18 +93,18 @@
% Although QR codes can encode any information up to almost three kilobytes, % Although QR codes can encode any information up to almost three kilobytes,
% their most common use is as physical hyperlinks: a mobile device scans % their most common use is as physical hyperlinks: a mobile device scans
% a printed QR code, decodes a URL, and automatically points a browser to that location. % a printed QR code, decodes a URL, and automatically points a browser to that location.
% %
% It is natural to want to include QR codes in certain \LaTeX\ documents; % It is natural to want to include QR codes in certain \LaTeX\ documents;
% for example, one may want to direct the reader of a printed page to % for example, one may want to direct the reader of a printed page to
% related interactive content online. % related interactive content online.
% Before now, the only \LaTeX\ package for producing QR codes was the % Before now, the only \LaTeX\ package for producing QR codes was the
% immensely flexible {\tt pst-barcode}. As that package relies on % immensely flexible {\tt pst-barcode}. As that package relies on
% {\tt pstricks}, however, it can be difficult to integrate with % {\tt pstricks}, however, it can be difficult to integrate with
% a pdf\LaTeX\ workflow,\footnote{% % a pdf\LaTeX\ workflow,\footnote{%
% The {\tt auto-pst-pdf} or {\tt pstool} packages can make this possible % The {\tt auto-pst-pdf} or {\tt pstool} packages can make this possible
% by automatically running % by automatically running
% \LaTeX${}\rightarrow \tt dvips \rightarrow ps2pdf \rightarrow pdfcrop$ % \LaTeX${}\rightarrow \tt dvips \rightarrow ps2pdf \rightarrow pdfcrop$
% for each barcode generated in {\tt pstricks}, % for each barcode generated in {\tt pstricks},
% so long as the user is able and willing to enable {\tt\string\write18} % so long as the user is able and willing to enable {\tt\string\write18}
% in {\tt pdflatex} and install Perl. % in {\tt pdflatex} and install Perl.
% Judging by questions on {\tt tex.stackexchange.com} and {\tt latexcommunity.org}, % Judging by questions on {\tt tex.stackexchange.com} and {\tt latexcommunity.org},
@ -114,16 +114,16 @@
% and a pdf\LaTeX\ user may not want the extra overhead just to produce a QR code. % and a pdf\LaTeX\ user may not want the extra overhead just to produce a QR code.
% If one wants to avoid {\tt pstricks}, a Lua\TeX\ solution was proposed at % If one wants to avoid {\tt pstricks}, a Lua\TeX\ solution was proposed at
% {\tt http://tex.stackexchange.com/questions/89649/}, % {\tt http://tex.stackexchange.com/questions/89649/},
% and a plain\TeX\ solution can be found at % and a plain\TeX\ solution can be found at
% {\catcode`\~=12\tt http://ktiml.mff.cuni.cz/~maj/QRcode.TeX}, % {\catcode`\~=12\tt http://ktiml.mff.cuni.cz/~maj/QRcode.TeX},
% but until now no \LaTeX\ package had been available that did not call on outside machinery. % but until now no \LaTeX\ package had been available that did not call on outside machinery.
% %
% The {\tt qrcode} package, in contrast, implements the QR code algorithm using % The {\tt qrcode} package, in contrast, implements the QR code algorithm using
% only \TeX\ and \LaTeX\ commands, so it should work with any \LaTeX\ workflow. % only \TeX\ and \LaTeX\ commands, so it should work with any \LaTeX\ workflow.
% Because it draws the squares constituting a QR code using the \TeX\ primitive % Because it draws the squares constituting a QR code using the \TeX\ primitive
% |\rule|, there is no need to load any graphics package whatsoever. % |\rule|, there is no need to load any graphics package whatsoever.
% For a user who merely wants a QR code, this is the simplest solution. % For a user who merely wants a QR code, this is the simplest solution.
% %
% \section{Usage}\label{sect:usage} % \section{Usage}\label{sect:usage}
% %
% %
@ -141,26 +141,26 @@
% The few exceptions to this are described in section \ref{sect:specialcharacters}. % The few exceptions to this are described in section \ref{sect:specialcharacters}.
% %
% \subsection{Package Options} % \subsection{Package Options}
% %
% \DescribeMacro{nolinks} % \DescribeMacro{nolinks}
% When the |hyperref| package is loaded, % When the |hyperref| package is loaded,
% by default |\qrcode| assumes its argument is a URL % by default |\qrcode| assumes its argument is a URL
% and makes the QR code produced a hyperlink to that URL. % and makes the QR code produced a hyperlink to that URL.
% This default behavior may be changed by invoking the |nolinks| package option. % This default behavior may be changed by invoking the |nolinks| package option.
% For example, most of the QR codes in this document are not in fact URLs, % For example, most of the QR codes in this document are not in fact URLs,
% so this documentation was typeset with |\usepackage[nolinks]{qrcode}|. % so this documentation was typeset with |\usepackage[nolinks]{qrcode}|.
% The |hyperlinks| option is an antonym to |nolinks| and is the default. % The |hyperlinks| option is an antonym to |nolinks| and is the default.
% These options have no effect if hyperref is not loaded. % These options have no effect if hyperref is not loaded.
% %
% \DescribeMacro{draft} % \DescribeMacro{draft}
% \DescribeMacro{final} % \DescribeMacro{final}
% Creating QR codes for short URLs takes relatively little time.\footnote{On % Creating QR codes for short URLs takes relatively little time.\footnote{On
% this author's laptop, even a 60-character URL (version 4, level M) adds % this author's laptop, even a 60-character URL (version 4, level M) adds
% only about 0.7 seconds of compilation time.} % only about 0.7 seconds of compilation time.}
% Because \TeX\ was designed for typesetting, not for extensive computations, % Because \TeX\ was designed for typesetting, not for extensive computations,
% however, if many small QR codes or a single large one are required, % however, if many small QR codes or a single large one are required,
% the time spent can be quite noticeable. To save compilation % the time spent can be quite noticeable. To save compilation
% time while working on a large document, calling the |draft| option % time while working on a large document, calling the |draft| option
% causes the package not to compute QR codes, but merely to insert placeholder % causes the package not to compute QR codes, but merely to insert placeholder
% symbols with no data. The |final| option is an antonym to |draft| % symbols with no data. The |final| option is an antonym to |draft|
% and is the default. % and is the default.
@ -169,7 +169,7 @@
% {\qrcode[draft,version=15]{http://www.tug.org}} % {\qrcode[draft,version=15]{http://www.tug.org}}
% & % &
% \begin{minipage}{3in} % \begin{minipage}{3in}
% \tt % \tt
% |\documentclass{article}| \\ % |\documentclass{article}| \\
% |\usepackage[draft]{qrcode}| \\ % |\usepackage[draft]{qrcode}| \\
% |\begin{document}| \\ % |\begin{document}| \\
@ -189,7 +189,7 @@
% %
% \DescribeMacro{forget} % \DescribeMacro{forget}
% There may be times when this is not desired; testing of this package is the chief % There may be times when this is not desired; testing of this package is the chief
% example, but one might also have reason to believe that the {\tt .aux} file % example, but one might also have reason to believe that the {\tt .aux} file
% contains bad data. % contains bad data.
% Invoking the |forget| package option causes |\qrcode| to calculate % Invoking the |forget| package option causes |\qrcode| to calculate
% every QR code anew, even if a QR code for that \meta{text to be encoded}, level, % every QR code anew, even if a QR code for that \meta{text to be encoded}, level,
@ -221,7 +221,7 @@
% \end{quote} % \end{quote}
% %
% \DescribeMacro{height} % \DescribeMacro{height}
% The |height=|\meta{dimen} key sets the printed height (and width) of the % The |height=|\meta{dimen} key sets the printed height (and width) of the
% QR code. The default value is {\tt 2cm}. % QR code. The default value is {\tt 2cm}.
% \begin{quote} % \begin{quote}
% \begin{tabular}{p{2in}p{2in}} % \begin{tabular}{p{2in}p{2in}}
@ -229,11 +229,11 @@
% & |\qrcode{ABCD}| |\qrcode[height=1cm]{ABCD}| % & |\qrcode{ABCD}| |\qrcode[height=1cm]{ABCD}|
% \end{tabular} % \end{tabular}
% \end{quote} % \end{quote}
% %
% \DescribeMacro{level} % \DescribeMacro{level}
% The QR code specification (ISO 18004:2006) includes four % The QR code specification (ISO 18004:2006) includes four
% levels of encoding: Low, Medium, Quality, and High, in % levels of encoding: Low, Medium, Quality, and High, in
% increasing order of error-correction capabaility. % increasing order of error-correction capabaility.
% In general, for a given text a higher error-correction % In general, for a given text a higher error-correction
% level requires more bits of information in the QR code. % level requires more bits of information in the QR code.
% The key |level=|\meta{level specification} % The key |level=|\meta{level specification}
@ -242,17 +242,17 @@
% the default is |M|. % the default is |M|.
% It may happen that the smallest QR code able to encode % It may happen that the smallest QR code able to encode
% the specified text at the desired level % the specified text at the desired level
% is in fact large enough to provide a higher level of % is in fact large enough to provide a higher level of
% error-correction. If so, {\tt qrcode} automatically upgrades to the higher % error-correction. If so, {\tt qrcode} automatically upgrades to the higher
% error-correction level, and a message is printed in the log file. % error-correction level, and a message is printed in the log file.
% %
% \DescribeMacro{version} % \DescribeMacro{version}
% QR codes range in size from $21\times 21$ modules (``version 1'') % QR codes range in size from $21\times 21$ modules (``version 1'')
% to $177\times 177$ modules (``version 40''), in steps of 4 modules. % to $177\times 177$ modules (``version 40''), in steps of 4 modules.
% The package automatically selects the smallest version large enough to encode % The package automatically selects the smallest version large enough to encode
% the specified text at the desired error-correction level. % the specified text at the desired error-correction level.
% Nevertheless, there might be occasions when a specific version is required; % Nevertheless, there might be occasions when a specific version is required;
% for example, perhaps a set of QR codes should have the same dimensions for % for example, perhaps a set of QR codes should have the same dimensions for
% aesthetic reasons, even though some encode shorter texts than others. % aesthetic reasons, even though some encode shorter texts than others.
% For this reason, the key |version=|\meta{version specification} allows the user % For this reason, the key |version=|\meta{version specification} allows the user
% to specify a minimum version number, from 1 through 40, for the QR code. % to specify a minimum version number, from 1 through 40, for the QR code.
@ -264,7 +264,7 @@
% \begin{tabular}{p{5.2cm}p{3in}} % \begin{tabular}{p{5.2cm}p{3in}}
% \raggedright % \raggedright
% \qrcode{ABCD} % \qrcode{ABCD}
% \qrcode[version=5]{ABCD} % \qrcode[version=5]{ABCD}
% \medskip \\ % \medskip \\
% \qrcode[version=10]{ABCD} % \qrcode[version=10]{ABCD}
% \qrcode[version=20]{ABCD} % \qrcode[version=20]{ABCD}
@ -279,27 +279,27 @@
% \end{tabular} % \end{tabular}
% \end{quote} % \end{quote}
% %
% %
% \DescribeMacro{tight} % \DescribeMacro{tight}
% \DescribeMacro{padding} % \DescribeMacro{padding}
% The QR specification states that a QR code should be surrounded by white\-space % The QR specification states that a QR code should be surrounded by white\-space
% of a width equal to that of four modules. In many applications, a document % of a width equal to that of four modules. In many applications, a document
% author is likely to provide sufficient spacing anyway (e.g., by placing the % author is likely to provide sufficient spacing anyway (e.g., by placing the
% QR code in a {\tt center} environment, header, or |\marginpar|), so by % QR code in a {\tt center} environment, header, or |\marginpar|), so by
% default the |qrcode| package adds no spacing. If the option |padding| is % default the |qrcode| package adds no spacing. If the option |padding| is
% specified, however, the QR code will automatically be surrounded with 4 modules' % specified, however, the QR code will automatically be surrounded with 4 modules'
% worth of white\-space. The key |tight| is an antonym of |padding|; the default is |tight|. % worth of white\-space. The key |tight| is an antonym of |padding|; the default is |tight|.
% %
% \DescribeMacro{link} % \DescribeMacro{link}
% \DescribeMacro{nolink} % \DescribeMacro{nolink}
% \DescribeMacro{\qrcode*} % \DescribeMacro{\qrcode*}
% As described above, if the |hyperref| package is loaded, % As described above, if the |hyperref| package is loaded,
% then the QR codes produced in a PDF document can be made % then the QR codes produced in a PDF document can be made
% into hyperlinks to their text. The default behavior % into hyperlinks to their text. The default behavior
% can be controlled with the options |nolinks| and |hyperlinks|, % can be controlled with the options |nolinks| and |hyperlinks|,
% but this default can be overridden for individual QR codes by invoking % but this default can be overridden for individual QR codes by invoking
% the options |link| or |nolink|. % the options |link| or |nolink|.
% Moreover, the starred version of the macro, |\qrcode*|, is a shorthand % Moreover, the starred version of the macro, |\qrcode*|, is a shorthand
% equivalent to |\qrcode[nolink]|. % equivalent to |\qrcode[nolink]|.
% \begin{quote} % \begin{quote}
% \begin{tabular}{p{5.2cm}p{3in}} % \begin{tabular}{p{5.2cm}p{3in}}
@ -307,7 +307,7 @@
% \qrset{link, height=1.5cm} % \qrset{link, height=1.5cm}
% \qrcode{http://www.ctan.org} % \qrcode{http://www.ctan.org}
% \qrcode[nolink]{This is not a URL.} % \qrcode[nolink]{This is not a URL.}
% \qrcode*{Neither is this.} % \qrcode*{Neither is this.}
% & % &
% \begin{minipage}{3in} % \begin{minipage}{3in}
% |\qrset{link, height=1.5cm}| \\ % |\qrset{link, height=1.5cm}| \\
@ -317,21 +317,21 @@
% \end{minipage} % \end{minipage}
% \end{tabular} % \end{tabular}
% \end{quote} % \end{quote}
% %
% \subsection{Special characters}\label{sect:specialcharacters} % \subsection{Special characters}\label{sect:specialcharacters}
% Many URLs can be processed by \TeX\ with no hiccups, % Many URLs can be processed by \TeX\ with no hiccups,
% but not infrequently a URL may contain the symbols |%|, |#|, % but not infrequently a URL may contain the symbols |%|, |#|,
% |~|, |_|, and |&|. Moreover, QR codes need not just contain % |~|, |_|, and |&|. Moreover, QR codes need not just contain
% URL's, so a user may wish to encode text containing |^|, |$|, or spaces. % URL's, so a user may wish to encode text containing |^|, |$|, or spaces.
% The |qrcode| package offers two ways of coping with these special characters. % The |qrcode| package offers two ways of coping with these special characters.
% %
% First, the |\qrcode| command itself processes its \meta{text to be encoded} % First, the |\qrcode| command itself processes its \meta{text to be encoded}
% in a limited verbatim mode. The following characters will be encoded into % in a limited verbatim mode. The following characters will be encoded into
% the QR code as typed: % the QR code as typed:
% \begin{center} % \begin{center}
% |#| |$| |&| |^| |_| |~| |%| {\tt\char32} % |#| |$| |&| |^| |_| |~| |%| {\tt\char32}
% \end{center} % \end{center}
% and line breaks as well.\footnote{Technically, when the input character % and line breaks as well.\footnote{Technically, when the input character
% {\tt\char`\^\char`\^M} (CR, charcode 13) is encountered, % {\tt\char`\^\char`\^M} (CR, charcode 13) is encountered,
% the character {\tt\char`\^\char`\^J} (LF, charcode 10) is placed into the QR code.} % the character {\tt\char`\^\char`\^J} (LF, charcode 10) is placed into the QR code.}
% Conspicuously absent from this list are |\|, |{|, and |}|. % Conspicuously absent from this list are |\|, |{|, and |}|.
@ -355,8 +355,8 @@
% \end{minipage} % \end{minipage}
% \end{tabular} % \end{tabular}
% \end{quote} % \end{quote}
% %
% As with all verbatim modes, however, because \TeX\ irrevocably sets catcodes % As with all verbatim modes, however, because \TeX\ irrevocably sets catcodes
% when it first encounters characters, this will not work if the |\qrcode| macro % when it first encounters characters, this will not work if the |\qrcode| macro
% is contained in another macro. If you call |\qrcode| inside an % is contained in another macro. If you call |\qrcode| inside an
% |\fbox| or a |\marginpar|, for example, and if your URL contains one of those % |\fbox| or a |\marginpar|, for example, and if your URL contains one of those
@ -370,11 +370,11 @@
% A line break may be obtained with |\?|. % A line break may be obtained with |\?|.
% \begin{quote} % \begin{quote}
% \begin{tabular}{p{1.5cm}p{2in}} % \begin{tabular}{p{1.5cm}p{2in}}
% \fbox{\qrcode[height=1cm]{\#\$\&\^\_\~\?\%\ \\\{\}}} % \fbox{\qrcode[height=1cm]{\#\$\&\^\_\~\?\%\ \\\{\}}}
% & |\fbox{qrcode[height=1cm]{\#\$\&\^\_\~\?\%\ \\\{\}}}| % & |\fbox{qrcode[height=1cm]{\#\$\&\^\_\~\?\%\ \\\{\}}}|
% \end{tabular} % \end{tabular}
% \end{quote} % \end{quote}
% %
% \section{Limitations and Cautions} % \section{Limitations and Cautions}
% %
% \begin{itemize} % \begin{itemize}
@ -384,9 +384,9 @@
% \item The QR specification offers ways to string lengthy data across multiple % \item The QR specification offers ways to string lengthy data across multiple
% QR codes. This package does not implement that possibility. % QR codes. This package does not implement that possibility.
% \end{itemize} % \end{itemize}
% %
% \StopEventually{} % \StopEventually{}
% %
% \section{Implementation} % \section{Implementation}
% \subsection{Key handling and options} % \subsection{Key handling and options}
% \begin{macrocode} % \begin{macrocode}
@ -466,7 +466,7 @@
\ifx\qr@testi\qr@relax \ifx\qr@testi\qr@relax
%we are done. %we are done.
\let\qr@next=\relax% \let\qr@next=\relax%
\else \else
\advance\qr@a by 1% \advance\qr@a by 1%
\def\qr@next{\qr@stringlength@recursive(#2)}% \def\qr@next{\qr@stringlength@recursive(#2)}%
\fi \fi
@ -483,7 +483,7 @@
% For example, |\qr@for \i=1 to 8 by 2 {\fbox{\number\i}}| % For example, |\qr@for \i=1 to 8 by 2 {\fbox{\number\i}}|
% produces {\makeatletter\qr@for \i=1 to 8 by 2 {\fbox{\number\i}}}. % produces {\makeatletter\qr@for \i=1 to 8 by 2 {\fbox{\number\i}}}.
% \begin{macrocode} % \begin{macrocode}
%The \qr@for@depth counter measures the depth of our loop. %The \qr@for@depth counter measures the depth of our loop.
%The outermost loop has depth zero. %The outermost loop has depth zero.
\newcount\qr@for@depth% \newcount\qr@for@depth%
\newcount\qr@for@maxdepth% \newcount\qr@for@maxdepth%
@ -508,7 +508,7 @@
}% }%
\long\def\qr@for@int#1#2#3#4#5{% \long\def\qr@for@int#1#2#3#4#5{%
\bgroup \bgroup
%Because we're working within a TeX group, %Because we're working within a TeX group,
%any values of \qr@for@start, \qr@for@end, and \qr@for@step from an outer loop %any values of \qr@for@start, \qr@for@end, and \qr@for@step from an outer loop
%will be restored after the \egroup. %will be restored after the \egroup.
% %
@ -790,7 +790,7 @@
{\catcode`\_=12\relax\gdef\qr@otherunderscore{_}}% {\catcode`\_=12\relax\gdef\qr@otherunderscore{_}}%
{\catcode`\$=12\relax\gdef\qr@otherdollar{$}}% {\catcode`\$=12\relax\gdef\qr@otherdollar{$}}%
%Line feeds require some special handling. \TeX\ reads a line feed in the input %Line feeds require some special handling. \TeX\ reads a line feed in the input
%as |^^M| (carriage return, character code 13), but it should be encoded in a %as |^^M| (carriage return, character code 13), but it should be encoded in a
%QR code as |^^J| (line feed, character code 10). %QR code as |^^J| (line feed, character code 10).
%To do this, we make |^^M| an active character and a synonym for a |^^J| with catcode 12. %To do this, we make |^^M| an active character and a synonym for a |^^J| with catcode 12.
@ -1003,7 +1003,7 @@
% to the (#5,#6) position of matrix #4. % to the (#5,#6) position of matrix #4.
\xa\xa\xa\global% \xa\xa\xa\global%
\xa\xa\xa\let\xa\xa\csname #4@#5@#6\endcsname% \xa\xa\xa\let\xa\xa\csname #4@#5@#6\endcsname%
\csname #1@#2@#3\endcsname% \csname #1@#2@#3\endcsname%
}% }%
\def\qr@createduplicatematrix#1#2{% \def\qr@createduplicatematrix#1#2{%
@ -1078,7 +1078,7 @@
\stepcounter{qr@j}% \stepcounter{qr@j}%
}% }%
\stepcounter{qr@i}% \stepcounter{qr@i}%
}% }%
}% }%
\newif\ifqr@incorner% \newif\ifqr@incorner%
@ -1088,7 +1088,7 @@
%They begin in row 7, column 7, %They begin in row 7, column 7,
%except that the ones in the NW, NE, and SW corners %except that the ones in the NW, NE, and SW corners
%are omitted because of the finder patterns. %are omitted because of the finder patterns.
%Recall that %Recall that
% * \qr@k stores k, % * \qr@k stores k,
% * \qr@alignment@firstskip stores how far between the 1st and 2nd row/col, & % * \qr@alignment@firstskip stores how far between the 1st and 2nd row/col, &
% * \qr@alignment@generalskip stores how far between each subsequent row/col. % * \qr@alignment@generalskip stores how far between each subsequent row/col.
@ -1341,7 +1341,7 @@
\newif\ifqr@cellinmask \newif\ifqr@cellinmask
\def\qr@setmaskingfunction#1{% \def\qr@setmaskingfunction#1{%
% #1 = 1 decimal digit for the mask. (I see no reason to use the 3-bit binary code.) % #1 = 1 decimal digit for the mask. (I see no reason to use the 3-bit binary code.)
% The current position is (\themaski,\themaskj), with indexing starting at 0. % The current position is (\themaski,\themaskj), with indexing starting at 0.
\edef\qr@maskselection{#1}% \edef\qr@maskselection{#1}%
\xa\ifcase\qr@maskselection\relax \xa\ifcase\qr@maskselection\relax
@ -1472,7 +1472,7 @@
% but the LaTeX counters (maski,maskj) should contain % but the LaTeX counters (maski,maskj) should contain
% the current position with indexing starting at 0. % the current position with indexing starting at 0.
% That is, maski = \i-1 and maskj = \j-1. % That is, maski = \i-1 and maskj = \j-1.
% %
% \qr@parsemaskingfunction must have been set by a call to \qr@setmaskingfunction % \qr@parsemaskingfunction must have been set by a call to \qr@setmaskingfunction
\qr@parsemaskingfunction \qr@parsemaskingfunction
\xa\ifnum\qr@maskfunctionresult=0\relax \xa\ifnum\qr@maskfunctionresult=0\relax
@ -1623,7 +1623,7 @@
% LASTFIVE CODE FOR PENALTY 1 % LASTFIVE CODE FOR PENALTY 1
% First, add the new bit to the end. % First, add the new bit to the end.
\xa\g@addto@macro\xa\qr@lastfive\xa{\qr@newbit}% \xa\g@addto@macro\xa\qr@lastfive\xa{\qr@newbit}%
\ifnum\j<5\relax% \ifnum\j<5\relax%
%Not yet on the 5th entry. %Not yet on the 5th entry.
%Don't do any testing. %Don't do any testing.
\else \else
@ -1691,7 +1691,7 @@
% LASTNINE CODE FOR PENALTY 3 % LASTNINE CODE FOR PENALTY 3
% First, add the new bit to the end. % First, add the new bit to the end.
\xa\g@addto@macro\xa\qr@lastnine\xa{\qr@newbit}% \xa\g@addto@macro\xa\qr@lastnine\xa{\qr@newbit}%
\ifnum\j<7\relax% \ifnum\j<7\relax%
%Not yet on the 7th entry. %Not yet on the 7th entry.
%Don't do any testing. %Don't do any testing.
\else \else
@ -1768,7 +1768,7 @@
% LASTFIVE CODE FOR PENALTY 1 % LASTFIVE CODE FOR PENALTY 1
% First, add the new bit to the end. % First, add the new bit to the end.
\xa\g@addto@macro\xa\qr@lastfive\xa{\qr@newbit}% \xa\g@addto@macro\xa\qr@lastfive\xa{\qr@newbit}%
\ifnum\i<5\relax% \ifnum\i<5\relax%
%Not yet on the 5th entry. %Not yet on the 5th entry.
%Don't do any testing. %Don't do any testing.
\else \else
@ -1806,7 +1806,7 @@
% LASTNINE CODE FOR PENALTY 3 % LASTNINE CODE FOR PENALTY 3
% First, add the new bit to the end. % First, add the new bit to the end.
\xa\g@addto@macro\xa\qr@lastnine\xa{\qr@newbit}% \xa\g@addto@macro\xa\qr@lastnine\xa{\qr@newbit}%
\ifnum\i<7\relax% \ifnum\i<7\relax%
%Not yet on the 7th entry. %Not yet on the 7th entry.
%Don't do any testing. %Don't do any testing.
\else \else
@ -2019,7 +2019,7 @@
% In two transposed regions, so we can write both at the same time. % In two transposed regions, so we can write both at the same time.
% In the comments, we describe what happens in the lower-left region, % In the comments, we describe what happens in the lower-left region,
% not the upper-right. % not the upper-right.
% %
%Set \qr@topline equal to n-10. %Set \qr@topline equal to n-10.
\qr@a=\qr@size\relax% \qr@a=\qr@size\relax%
\advance\qr@a by -10\relax% \advance\qr@a by -10\relax%
@ -2050,7 +2050,7 @@
\qr@next \qr@next
}% }%
% \end{macrocode} % \end{macrocode}
% %
% \subsection{Encoding and error correction} % \subsection{Encoding and error correction}
% \begin{macrocode} % \begin{macrocode}
\newcounter{qr@hexchars}% \newcounter{qr@hexchars}%
@ -2221,7 +2221,7 @@
\xdef\qr@writefromblock@remainder{#1}% \xdef\qr@writefromblock@remainder{#1}%
}% }%
% \end{macrocode} % \end{macrocode}
% %
% \subsection{Encoding format and version information} % \subsection{Encoding format and version information}
% \begin{macrocode} % \begin{macrocode}
\let\xa=\expandafter \let\xa=\expandafter
@ -2257,7 +2257,7 @@
% #2 = g(x), of degree m % #2 = g(x), of degree m
% Obtains a new polynomial h(x), congruent to f(x) modulo g(x), % Obtains a new polynomial h(x), congruent to f(x) modulo g(x),
% but of degree at most n-1. % but of degree at most n-1.
% %
% If leading coefficient of f(x) is 1, subtracts off g(x) * x^(n-m). % If leading coefficient of f(x) is 1, subtracts off g(x) * x^(n-m).
% If leading coefficient of f(x) is 0, strips off that leading zero. % If leading coefficient of f(x) is 0, strips off that leading zero.
% %
@ -2388,14 +2388,14 @@
\edef\qr@Golayresult{\qr@versioninfo\qr@theremainder}% \edef\qr@Golayresult{\qr@versioninfo\qr@theremainder}%
}% }%
% \end{macrocode} % \end{macrocode}
% %
% \subsection{Error correction} % \subsection{Error correction}
% The error-correction code is defined over $\F_{256}=GF(256)$, % The error-correction code is defined over $\F_{256}=GF(256)$,
% the finite field of order $256$. % the finite field of order $256$.
% The QR specification encodes this field as $\F_2[X]/(X^8+X^4+X^3+X^2+1)$; % The QR specification encodes this field as $\F_2[X]/(X^8+X^4+X^3+X^2+1)$;
% in other words, each field element is an 8-bit binary string representing % in other words, each field element is an 8-bit binary string representing
% an integer between 0 and 255. % an integer between 0 and 255.
% %
% We represent these 8-bit strings as two hexadecimal characters; % We represent these 8-bit strings as two hexadecimal characters;
% for example, {\tt 5a} represents {\tt 01011010}. % for example, {\tt 5a} represents {\tt 01011010}.
% Because addition is done by xor-ing the bitstrings, % Because addition is done by xor-ing the bitstrings,
@ -2627,7 +2627,7 @@
\def\qr@testi{#1}% \def\qr@testi{#1}%
\ifx\qr@testi\qr@relax \ifx\qr@testi\qr@relax
%we are done. %we are done.
\else \else
\stepcounter{qr@i}% \stepcounter{qr@i}%
%\showthe\c@qr@i %\showthe\c@qr@i
\qr@stringlength@recursive(#3)% \qr@stringlength@recursive(#3)%
@ -2665,7 +2665,7 @@
% #2 = g(x), of degree m % #2 = g(x), of degree m
% Obtains a new polynomial h(x), congruent to f(x) modulo g(x), % Obtains a new polynomial h(x), congruent to f(x) modulo g(x),
% but of degree at most n-1. % but of degree at most n-1.
% %
% If leading coefficient of f(x) is 0, strips off that leading zero. % If leading coefficient of f(x) is 0, strips off that leading zero.
% If leading coefficient of f(x) is a, subtracts off a * g(x) * x^(n-m). % If leading coefficient of f(x) is a, subtracts off a * g(x) * x^(n-m).
% N.B. we assume g is monic. % N.B. we assume g is monic.
@ -2803,7 +2803,7 @@
\edef\FX@errorbytes{\qr@theremainder}% \edef\FX@errorbytes{\qr@theremainder}%
}% }%
% \end{macrocode} % \end{macrocode}
% %
% \subsection{Version handling} % \subsection{Version handling}
% \begin{macrocode} % \begin{macrocode}
\newif\ifqr@versionmodules \newif\ifqr@versionmodules
@ -2811,7 +2811,7 @@
\def\qr@level@char#1{% \def\qr@level@char#1{%
\xa\ifcase#1 \xa\ifcase#1
M\or L\or H\or Q\fi}% M\or L\or H\or Q\fi}%
\newif\ifqr@versiongoodenough \newif\ifqr@versiongoodenough
\def\qr@choose@best@version#1{% \def\qr@choose@best@version#1{%
% \qr@desiredversion = user-requested version % \qr@desiredversion = user-requested version
@ -2819,7 +2819,7 @@
\edef\qr@plaintext{#1}% \edef\qr@plaintext{#1}%
\qr@getstringlength{\qr@plaintext}% \qr@getstringlength{\qr@plaintext}%
% %
%Run double loop over levels and versions, looking for %Run double loop over levels and versions, looking for
%the smallest version that can contain our data, %the smallest version that can contain our data,
%and then choosing the best error-correcting level at that version, %and then choosing the best error-correcting level at that version,
%subject to the level being at least as good as the user desires. %subject to the level being at least as good as the user desires.
@ -2835,7 +2835,7 @@
{\edef\qr@version{\the\i}% {\edef\qr@version{\the\i}%
\global\qr@versiongoodenoughfalse \global\qr@versiongoodenoughfalse
\qr@for \j=0 to 3 by 1% \qr@for \j=0 to 3 by 1%
{%First, we map {0,1,2,3} to {1,0,4,3}, so that we loop through {M,L,H,Q} {%First, we map {0,1,2,3} to {1,0,4,3}, so that we loop through {M,L,H,Q}
%in order of increasing error-correction capabilities. %in order of increasing error-correction capabilities.
\qr@a = \j\relax \qr@a = \j\relax
\divide \qr@a by 2\relax \divide \qr@a by 2\relax
@ -3034,8 +3034,8 @@
% %
% %
% %
% Our \qr@totaldatacodewords bytes of data are broken up as evenly as possible % Our \qr@totaldatacodewords bytes of data are broken up as evenly as possible
% into \qr@numblocks datablocks; some may be one byte longer than others. % into \qr@numblocks datablocks; some may be one byte longer than others.
% We set \qr@shortblock@size to floor(\qr@totaldatacodewords / \qr@numblocks) % We set \qr@shortblock@size to floor(\qr@totaldatacodewords / \qr@numblocks)
% and \qr@numlongblocks to mod(\qr@totaldatacodewords , \qr@numblocks). % and \qr@numlongblocks to mod(\qr@totaldatacodewords , \qr@numblocks).
\qr@a=\qr@totaldatacodewords\relax \qr@a=\qr@totaldatacodewords\relax
@ -3333,7 +3333,7 @@
}% }%
\def\qrcode@int{% \def\qrcode@int{%
\message{^^J^^J<QR code requested for "\qr@texttoencode" in version \message{^^J^^J<QR code requested for "\qr@texttoencode" in version
\qr@desiredversion-\qr@level@char{\qr@desiredlevel}.>^^J}% \qr@desiredversion-\qr@level@char{\qr@desiredlevel}.>^^J}%
%First, choose the version and level. %First, choose the version and level.
%Recall that \qr@choose@best@version sets \qr@version and \qr@level. %Recall that \qr@choose@best@version sets \qr@version and \qr@level.
@ -3346,7 +3346,7 @@
\let\qrcode@wrapper=\relax% \let\qrcode@wrapper=\relax%
\fi% \fi%
% %
%Next, check whether we have already encoded this text at this version %Next, check whether we have already encoded this text at this version
%and level. %and level.
\qrcode@wrapper{% \qrcode@wrapper{%
\xa\ifx\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname \xa\ifx\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname
@ -3373,7 +3373,7 @@
\qr@placedummyformatpatterns{newqr}% \qr@placedummyformatpatterns{newqr}%
\qr@placedummyversionpatterns{newqr}% \qr@placedummyversionpatterns{newqr}%
\ifqr@draft@mode \ifqr@draft@mode
\message{<Inserting dummy QR code in draft mode for "\qr@texttoencode" in \message{<Inserting dummy QR code in draft mode for "\qr@texttoencode" in
version \qr@version-\qr@level@char{\qr@level}.>^^J}% version \qr@version-\qr@level@char{\qr@level}.>^^J}%
\relax% Draft mode---don't load any data or do any work. Also don't save! \relax% Draft mode---don't load any data or do any work. Also don't save!
\def\qr@format@square{\qr@black}% \def\qr@format@square{\qr@black}%
@ -3381,7 +3381,7 @@
\fboxsep=-\fboxrule% \fboxsep=-\fboxrule%
\fbox{\qr@printmatrix{newqr}}% \fbox{\qr@printmatrix{newqr}}%
\else \else
\message{<Calculating QR code for "\qr@texttoencode" in \message{<Calculating QR code for "\qr@texttoencode" in
version \qr@version-\qr@level@char{\qr@level}.>^^J}% version \qr@version-\qr@level@char{\qr@level}.>^^J}%
\xa\qr@encode@binary\xa{\qr@texttoencode}% \xa\qr@encode@binary\xa{\qr@texttoencode}%
\qr@splitcodetextintoblocks \qr@splitcodetextintoblocks
@ -3408,7 +3408,7 @@
\qr@matrixtobinary{newqr}% \qr@matrixtobinary{newqr}%
% %
%Now save the binary version into TeX's memory for later use in this document. %Now save the binary version into TeX's memory for later use in this document.
\xa\xdef\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname \xa\xdef\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname
{\qr@binarymatrix@result}% {\qr@binarymatrix@result}%
\message{done.>^^J}% \message{done.>^^J}%
% %
@ -3429,7 +3429,7 @@
\xa\qr@printsavedbinarymatrix\xa{\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname}% \xa\qr@printsavedbinarymatrix\xa{\csname qr@savedbinarymatrix@\qr@texttoencode @\qr@version @\qr@level\endcsname}%
% %
% Now this still might need to be written to the aux file. % Now this still might need to be written to the aux file.
% %
\xa\ifx\csname qr@savedflag@\qr@texttoencode @\qr@version @\qr@level\endcsname\@qr@TRUE \xa\ifx\csname qr@savedflag@\qr@texttoencode @\qr@version @\qr@level\endcsname\@qr@TRUE
%Okay, this has already been written to aux file. %Okay, this has already been written to aux file.
%Do nothing. %Do nothing.
@ -3451,7 +3451,7 @@
\def\qr@white@fixed{0}% \def\qr@white@fixed{0}%
\def\qr@black@format{1}% \def\qr@black@format{1}%
\def\qr@white@format{0}% \def\qr@white@format{0}%
% %
\qr@for \i = 1 to \qr@size by 1% \qr@for \i = 1 to \qr@size by 1%
{\qr@for \j = 1 to \qr@size by 1% {\qr@for \j = 1 to \qr@size by 1%
{\edef\qr@theentry{\qr@matrixentry{#1}{\the\i}{\the\j}}% {\edef\qr@theentry{\qr@matrixentry{#1}{\the\i}{\the\j}}%

View File

@ -10,7 +10,7 @@
%% version 2005/12/01 or later. %% version 2005/12/01 or later.
%% %%
%% This work has the LPPL maintenance status `maintained'. %% This work has the LPPL maintenance status `maintained'.
%% %%
%% The Current Maintainer of this work is Anders O.F. Hendrickson. %% The Current Maintainer of this work is Anders O.F. Hendrickson.
%% %%
%% This work consists of the files qrcode.dtx and qrcode.ins %% This work consists of the files qrcode.dtx and qrcode.ins

View File

@ -5,11 +5,11 @@
%% The original source files were: %% The original source files were:
%% %%
%% qrcode.dtx (with options: `package') %% qrcode.dtx (with options: `package')
%% %%
%% This is a generated file. %% This is a generated file.
%% %%
%% Copyright (C) 2015 by Anders Hendrickson <ahendric@cord.edu> %% Copyright (C) 2015 by Anders Hendrickson <ahendric@cord.edu>
%% %%
%% This work may be distributed and/or modified under the %% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3 %% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version. %% of this license or (at your option) any later version.
@ -17,7 +17,7 @@
%% http://www.latex-project.org/lppl.txt %% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX %% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later. %% version 2005/12/01 or later.
%% %%
\NeedsTeXFormat{LaTeX2e}[1999/12/01] \NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{qrcode} \ProvidesPackage{qrcode}
[2015/01/08 v1.51 QR code generation] [2015/01/08 v1.51 QR code generation]

View File

@ -7,7 +7,7 @@
% Displaystyle % Displaystyle
\newcommand{\ds}{\displaystyle} \newcommand{\ds}{\displaystyle}
% Ensembles % Ensembles
\newcommand{\N}{\mathbb{N}} \newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}} \newcommand{\Z}{\mathbb{Z}}
%\newcommand{\D}{\mathbb{D}} %\newcommand{\D}{\mathbb{D}}
@ -19,7 +19,7 @@
% intervalles ouvert ouvert % intervalles ouvert ouvert
\newcommand{\intOO}[2]{\left]{#1}\,{;}\,{#2}\right[} \newcommand{\intOO}[2]{\left]{#1}\,{;}\,{#2}\right[}
% intervalles ouvert fermé % intervalles ouvert fermé
\newcommand{\intOF}[2]{\left]{#1}\,{;}\,{#2}\right]} \newcommand{\intOF}[2]{\left]{#1}\,{;}\,{#2}\right]}
% intervalles fermé ouvert % intervalles fermé ouvert
\newcommand{\intFO}[2]{\left[{#1}\,{;}\,{#2}\right[} \newcommand{\intFO}[2]{\left[{#1}\,{;}\,{#2}\right[}
@ -32,7 +32,7 @@
\newcommand{\vect}[1]{\overrightarrow{#1}} \newcommand{\vect}[1]{\overrightarrow{#1}}
% Norme d'un vecteur % Norme d'un vecteur
\newcommand{\norme}[1]{||\vect{#1}||} \newcommand{\norme}[1]{||\vect{#1}||}
% Produit scalaire % Produit scalaire
\newcommand{\scal}[2]{\vect{#1} \cdot \vect{#2}} \newcommand{\scal}[2]{\vect{#1} \cdot \vect{#2}}
\newcommand{\vectCoord}[2]{% \newcommand{\vectCoord}[2]{%
{\renewcommand{\arraystretch}{1}% {\renewcommand{\arraystretch}{1}%
@ -43,7 +43,7 @@
% Les complexes % Les complexes
\def\Ouv{$\left(\text{O}~;~\vect{u},~\vect{v}\right)$} \def\Ouv{$\left(\text{O}~;~\vect{u},~\vect{v}\right)$}
\newcommand{\e}{\mathrm{\,e\,}}% le e de l'exponentielle \newcommand{\e}{\mathrm{\,e\,}}% le e de l'exponentielle
%\renewcommand{\i}{\mathrm{\,i\,}}% le i des complexes %\renewcommand{\i}{\mathrm{\,i\,}}% le i des complexes
%% Proba %% Proba
\newcommand{\coefBino}[2]{\vectCoord{#1}{#2}} \newcommand{\coefBino}[2]{\vectCoord{#1}{#2}}
@ -315,4 +315,3 @@
units=cm, units=cm,
scale=.1, scale=.1,
} }