Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 5
Benennung der Variablen korrigiert

20 Mär '19, 17:11

saputello's gravatar image

saputello
11.1k174365

Eigentlich kann man den Algorithmus von Ijon auch direkt mit LaTeX, ganz ohne Pakete umsetzen. Ich drehe hier mal nur zur Vereinfachung die Schleifen um: \documentclass[a4paper]{article} \makeatletter \newcommand*{\whilenum}{\@whilenum} \makeatother \newcounter{a}\renewcommand*{\thea}{\alph{a}} \newcounter{b}\renewcommand*{\theb}{\alph{b}} \newcounter{c}\renewcommand*{\thec}{\alph{c}} \newcounter{n} \begin{document} \raggedright \setcounter{a}{1} \setcounter{n}{1} \whilenum \value{a}<14 \do {% \setcounter{b}{\numexpr \value{a}+1\relax}% \whilenum \value{b}<15 \do {% \setcounter{c}{\numexpr \value{b}+1\relax}% \whilenum \value{c}<16 \do {% \textbf{\then.} \thea\theb\thec\\ \stepcounter{c}% \stepcounter{n}% }% \stepcounter{b}% }% \stepcounter{a}% } \end{document} Oder mit LaTeX3 (dieses Mal nahezu wörtlich umgesetzt): \documentclass[a4paper]{article} \usepackage{xparse} \ExplSyntaxOn \int_new:N \l_int_threeaboutfifteen_a \l__threeoffifteen_a_int \int_new:N \l_int_threeaboutfifteen_b \l__threeoffifteen_b_int \int_new:N \l_int_threeaboutfifteen_c \l__threeoffifteen_c_int \int_new:N \l_int_threeaboutfifteen_n \l__threeoffifteen_n_int \NewDocumentCommand \threeaboutfifteen \threeoffifteen { O{\\} } {% \int_set:Nn \l_int_threeaboutfifteen_n \l__threeoffifteen_n_int { 1 } \int_set:Nn \l_int_threeaboutfifteen_a \l__threeoffifteen_a_int { 15 } \int_while_do:nn { \l_int_threeaboutfifteen_a \l__threeoffifteen_a_int >= 3 } {% \int_set:Nn \l_int_threeaboutfifteen_b { \l_int_threeaboutfifteen_a \l__threeoffifteen_b_int { \l__threeoffifteen_a_int - 1 } \int_while_do:nn { \l_int_threeaboutfifteen_b \l__threeoffifteen_b_int >= 2 } {% \int_set:Nn \l_int_threeaboutfifteen_c { \l_int_threeaboutfifteen_b \l__threeoffifteen_c_int { \l__threeoffifteen_b_int - 1 } \int_while_do:nn { \l_int_threeaboutfifteen_c \l__threeoffifteen_c_int >= 1 } {% \textbf{ \int_to_arabic:n { \l_int_threeaboutfifteen_n \l__threeoffifteen_n_int } . } \nobreakspace \int_to_alph:n { 16 - \l_int_threeaboutfifteen_a \l__threeoffifteen_a_int } \int_to_alph:n { 16 - \l_int_threeaboutfifteen_b \l__threeoffifteen_b_int } \int_to_alph:n { 16 - \l_int_threeaboutfifteen_c \l__threeoffifteen_c_int } #1 \int_incr:N \l_int_threeaboutfifteen_n \l__threeoffifteen_n_int \int_decr:N \l_int_threeaboutfifteen_c \l__threeoffifteen_c_int }% \int_decr:N \l_int_threeaboutfifteen_b \l__threeoffifteen_b_int } \int_decr:N \l_int_threeaboutfifteen_a \l__threeoffifteen_a_int } } \ExplSyntaxOff \begin{document} \raggedright\threeaboutfifteen %\noindent\threeaboutfifteen[ \raggedright\threeoffifteen %\noindent\threeoffifteen[ ] \end{document} Verwendet man die Zeile `\noindent\threeaboutfifteen[ ]` statt der Zeile `\raggedright\theeaboutfifteen`, ist die Ausgabe: [![alt text][1]][1] Eine Abwandlung für `\threeofN`, wobei `N` ein zusätzliches Argument im Wertebereich 3 <= `N` <= 26 ist, wäre dabei einfach umzusetzen. Es muss also nicht immer `pgf` sein. Natürlich ist gut, wenn man `pgf` beherrscht. LaTeX3 zu lernen hat allerdings auch viele Vorteile. [1]: https://texwelt.de/wissen/upfiles/test_20190309_125915.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 4

09 Mär '19, 14:11

saputello's gravatar image

saputello
11.1k174365

Eigentlich kann man den Algorithmus von Ijon auch direkt mit LaTeX, ganz ohne Pakete umsetzen. Ich drehe hier mal nur zur Vereinfachung die Schleifen um: \documentclass[a4paper]{article} \makeatletter \newcommand*{\whilenum}{\@whilenum} \makeatother \newcounter{a}\renewcommand*{\thea}{\alph{a}} \newcounter{b}\renewcommand*{\theb}{\alph{b}} \newcounter{c}\renewcommand*{\thec}{\alph{c}} \newcounter{n} \begin{document} \raggedright \setcounter{a}{1} \setcounter{n}{1} \whilenum \value{a}<14 \do {% \setcounter{b}{\numexpr \value{a}+1\relax}% \whilenum \value{b}<15 \do {% \setcounter{c}{\numexpr \value{b}+1\relax}% \whilenum \value{c}<16 \do {% \textbf{\then.} \thea\theb\thec\\ \stepcounter{c}% \stepcounter{n}% }% \stepcounter{b}% }% \stepcounter{a}% } \end{document} Oder mit LaTeX3 (dieses Mal nahezu wörtlich umgesetzt): \documentclass[a4paper]{article} \usepackage{xparse} \ExplSyntaxOn \int_new:N \l_threeaboutfifteen_a \l_int_threeaboutfifteen_a \int_new:N \l_threeaboutfifteen_b \l_int_threeaboutfifteen_b \int_new:N \l_threeaboutfifteen_c \l_int_threeaboutfifteen_c \int_new:N \l_threeaboutfifteen_n \l_int_threeaboutfifteen_n \NewDocumentCommand \threeaboutfifteen { O{\\} } {% \int_set:Nn \l_threeaboutfifteen_n \l_int_threeaboutfifteen_n { 1 } \int_set:Nn \l_threeaboutfifteen_a \l_int_threeaboutfifteen_a { 15 } \int_while_do:nn { \l_threeaboutfifteen_a \l_int_threeaboutfifteen_a >= 3 } {% \int_set:Nn \l_threeaboutfifteen_b { \l_threeaboutfifteen_a \l_int_threeaboutfifteen_b { \l_int_threeaboutfifteen_a - 1 } \int_while_do:nn { \l_threeaboutfifteen_b \l_int_threeaboutfifteen_b >= 2 } {% \int_set:Nn \l_threeaboutfifteen_c { \l_threeaboutfifteen_b \l_int_threeaboutfifteen_c { \l_int_threeaboutfifteen_b - 1 } \int_while_do:nn { \l_threeaboutfifteen_c \l_int_threeaboutfifteen_c >= 1 } {% \textbf{ \int_to_arabic:n { \l_threeaboutfifteen_n \l_int_threeaboutfifteen_n } . } } \nobreakspace \int_to_alph:n { 16 - \l_threeaboutfifteen_a \l_int_threeaboutfifteen_a } \int_to_alph:n { 16 - \l_threeaboutfifteen_b \l_int_threeaboutfifteen_b } \int_to_alph:n { 16 - \l_threeaboutfifteen_c \l_int_threeaboutfifteen_c } #1 \int_incr:N \l_threeaboutfifteen_n \l_int_threeaboutfifteen_n \int_decr:N \l_threeaboutfifteen_c \l_int_threeaboutfifteen_c }% \int_decr:N \l_threeaboutfifteen_b \l_int_threeaboutfifteen_b } \int_decr:N \l_threeaboutfifteen_a \l_int_threeaboutfifteen_a } } \ExplSyntaxOff \begin{document} \raggedright \threeaboutfifteen % \threeaboutfifteen[ \raggedright\threeaboutfifteen %\noindent\threeaboutfifteen[ ] \end{document} Verwendet man `\threeaboutfifteen[ die Zeile `\noindent\threeaboutfifteen[ ]` statt `\theeaboutfifteen` und kommentiert `\raggedright` aus, der Zeile `\raggedright\theeaboutfifteen`, ist die Ausgabe: [![alt text][1]][1] Eine Abwandlung für `\threeofN`, wobei `N` ein zusätzliches Argument im Wertebereich 3 <= `N` <= 26 ist, wäre dabei einfach umzusetzen. Es muss also nicht immer `pgf` sein. Natürlich ist gut, wenn man `pgf` beherrscht. LaTeX3 zu lernen hat allerdings auch viele Vorteile. [1]: https://texwelt.de/wissen/upfiles/test_20190309_125915.pnghttps://texwelt.de/wissen/upfiles/test_20190309_125915.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 3

09 Mär '19, 13:35

saputello's gravatar image

saputello
11.1k174365

Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

09 Mär '19, 13:29

saputello's gravatar image

saputello
11.1k174365

Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

09 Mär '19, 13:28

saputello's gravatar image

saputello
11.1k174365