Gibt es eigentlich für Folgendes eine Möglichkeit:

Ich möchte \BefehlA und \BefehlB aufrufen.

Kann ich dann irgendwie \foreach \x in {A, B}{ \Befehl\x ~ } verwenden?

MWE:

Öffne in Overleaf
Code, hier editierbar zum Übersetzen:
\documentclass[margin=5pt]{standalone}
\usepackage{pgffor}
\begin{document}
\newcommand{\BefehlA}{Schreibe A}
\newcommand{\BefehlB}{Schreibe lB}
\foreach \x in {A, B}{ % geht so nicht:
%\Befehl\x ~
}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

gefragt 24 Sep '18, 22:58

cis's gravatar image

cis
9.6k103460491
Akzeptiert-Rate: 29%

bearbeitet 30 Sep '18, 09:42

cgnieder's gravatar image

cgnieder
22.1k253463

2

So etwas ähnliches hast Du übrigens vor Jahren schon einmal gefragt.

(25 Sep '18, 08:41) Bes

\csname ... \endcsname

Öffne in Overleaf
Code, hier editierbar zum Übersetzen:
\documentclass[margin=5pt]{standalone}
\usepackage{pgffor}
\begin{document}
\newcommand{\BefehlA}{Schreibe A}
\newcommand{\BefehlB}{Schreibe lB}
\foreach \x in {A, B}{
\csname Befehl\x\endcsname~
}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Alternativ kann man auch, wie in ConTeXt MKIV ein Macro dafür definieren.

Öffne in Overleaf
Code, hier editierbar zum Übersetzen:
\newcommand*\getvalue[1]{\csname#1\endcsname}
\getvalue{Befehl\x}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Um den in moewes Kommentar erwähnten \relax-Nebeneffekt zu umgehen, verwendet man eine leicht angepasste Definition von \getvalue:

Öffne in Overleaf
\newcommand*\getvalue[1]{\ifcsname#1\endcsname\csname#1\expandafter\endcsname\fi}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Permanenter link

beantwortet 24 Sep '18, 23:41

Henri's gravatar image

Henri
15.7k133943
Akzeptiert-Rate: 46%

bearbeitet 25 Sep '18, 01:01

1

etoolbox definiert \csuse, was in etwa so funktioniert wie \getvalue hier (nur ohne \relax-Nebeneffekt).

(25 Sep '18, 00:08) moewe

Ah super, wieder was gelernt.

(25 Sep '18, 00:14) cis
Deine Antwort
[Vorschau ausblenden]

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Frage-Themen:

×21
×5

gestellte Frage: 24 Sep '18, 22:58

Frage wurde gesehen: 3,907 Mal

zuletzt geändert: 25 Sep '18, 08:42

Willkommen, erstes Mal hier? Schau mal unter FAQ!

×