|
Autor |
LaTeX (hier): Erstellen einer Liste |
|
Ex_Senior
 | Themenstart: 2018-02-13
|
Hallo!
Wieso geht das hier nicht?
$
% \begin{tikzpicture} % lädt pgf.sty usw
\newcommand{\yticklist}{}% reserve global name
\let\yticklist=\empty% create scaled list
\foreach \y in {1.2, 2.4, 3.6}
{
\pgfmathadd{\y}{pi}%
\ifx\empty\yticklist\relax \xdef\yticklist{\pgfmathresult}%
\else \xdef\yticklist{\yticklist,\pgfmathresult}%
\fi
}
\yticklist
$
Hier
\sourceon MP
$
% \begin{tikzpicture} % lädt pgf.sty usw
\newcommand{\yticklist}{}% reserve global name
\let\yticklist=\empty% create scaled list
\foreach \y in {1.2, 2.4, 3.6}
{
\pgfmathadd{\y}{pi}%
\ifx\empty\yticklist\relax \xdef\yticklist{\pgfmathresult}%
\else \xdef\yticklist{\yticklist,\pgfmathresult}%
\fi
}
\yticklist
$
\sourceoff
Am eigenen PC
\sourceon latex
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\newcommand{\yticklist}{}% reserve global name
\let\yticklist=\empty% create scaled list
\foreach \y in {1.2, 2.4, 3.6}
{
\pgfmathadd{\y}{pi}%
\ifx\empty\yticklist\relax \xdef\yticklist{\pgfmathresult}%
\else \xdef\yticklist{\yticklist,\pgfmathresult}%
\fi
}
\yticklist
\end{document}
\sourceoff
Danke!
|
Profil
|
matroid
Senior  Dabei seit: 12.03.2001 Mitteilungen: 14588
Wohnort: Solingen
 | Beitrag No.1, eingetragen 2018-02-13
|
Hallo cis,
im Code ist die Verwendung von \relax kritisch.
Was macht \relax?
Gruß
Matroid
|
Profil
|
Ex_Senior
 | Beitrag No.2, vom Themenstarter, eingetragen 2018-02-13
|
\quoteon(2018-02-13 12:18 - matroid in Beitrag No. 1)
Was macht \relax?
\quoteoff
\relax heißt eigentlich "nichts machen" (ausführlicher: TeXWelt: Was macht \relax?)
Andererseits, wenn man ihm nicht sagt nichts zu machen, macht er auch nichts; und es tut:
$
% \begin{tikzpicture} % lädt pgf.sty usw
\newcommand{\yticklist}{}% reserve global name
\let\yticklist=\empty% create scaled list
\foreach \y in {0,1.2, 2.4, 3.6}
{
\pgfmathadd{\y}{pi}%
\ifx\empty\yticklist \xdef\yticklist{\pgfmathresult }%
\else \xdef\yticklist{\yticklist,\pgfmathresult }%
\fi
}
\yticklist
$
Ich habe das Code-Schnipsel hier gefunden. Ich weiß nicht, wie wichtig \relax ist. Möglicherweise ist '{}' hier äquivalent zu '\relax'.
$
% \begin{tikzpicture} % lädt pgf.sty usw
\newcommand{\yticklist}{}% reserve global name
\let\yticklist=\empty% create scaled list
\foreach \y in {0,1.2, 2.4, 3.6}
{
\pgfmathadd{\y}{pi}%
\ifx\empty\yticklist{} \xdef\yticklist{\pgfmathresult }%
\else \xdef\yticklist{\yticklist,\pgfmathresult }%
\fi
}
\yticklist
$
|
Profil
|
Ex_Senior hat die Antworten auf ihre/seine Frage gesehen. Ex_Senior hat selbst das Ok-Häkchen gesetzt. |
|
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2001-2023 by Matroids Matheplanet
This web site was originally made with PHP-Nuke, a former web portal system written in PHP that seems no longer to be maintained nor supported. PHP-Nuke is Free Software released under the GNU/GPL license.
Ich distanziere mich von rechtswidrigen oder anstößigen Inhalten, die sich trotz aufmerksamer Prüfung hinter hier verwendeten Links verbergen mögen. Lesen Sie die
Nutzungsbedingungen,
die Distanzierung,
die Datenschutzerklärung und das Impressum.
[Seitenanfang]
|