
Ich möchte, dass alle „Spalten“ in meiner „Ausrichtung“ den Text von links nach rechts beginnen (linksbündig).
Ich habe meinen Code unten eingefügt, der das folgende Ergebnis liefert:
Wie im Bild zu sehen:
- Der Text in der ersten Spalte verläuft von rechts nach links
- Der Text in der zweiten Spalte ist von links nach rechts
- Der Text in der dritten Spalte ist von rechts nach links
TEX-Datei:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
\text{min} \qquad & \sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} c^r_e x^r_e + \sum_{d \in \mathcal{D}} c^-_d s_d^- + \sum_{d \in \mathcal{D}} c^+_d s^+_d \label{MP1} \\
\text{s.t.} \qquad & \sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} a^r_{ed} x^r_e + s_d^- -s_d^+ = b_d & \forall d \in \mathcal{D} \label{MP2} \\
& \sum_{r\in \mathcal{R}_e} x^r_e = 1 & \forall e \in \mathcal{E} \label{MP3} \\
& x^r_e\in \{ 0,1\} & \forall e \in \mathcal{E}, \forall r \in \mathcal{R}_e \label{MP4} \\
& 0 \leq s_d^- \leq u_d^- & \forall d \in \mathcal{D} \label{MP5} \\
& 0 \leq s_d^+ \leq u_d^+ & \forall d \in \mathcal{D} \label{MP6}
\end{align}
\end{document}
Irgendwelche Vorschläge?
Antwort1
Wie Sie bemerkt haben, align
wird zwischen r
(rechtsbündigen) und l
(linksbündigen) Spalten gewechselt. Um nur linksbündige Spalten zu erhalten, können Sie &
die Spalten „überspringen“ r
:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
&\text{min} \qquad && \sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} c^r_e x^r_e + \sum_{d \in \mathcal{D}} c^-_d s_d^- + \sum_{d \in \mathcal{D}} c^+_d s^+_d \label{MP1} \\
& \text{s.t.} \qquad && \sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} a^r_{ed} x^r_e + s_d^- -s_d^+ = b_d && \forall d \in \mathcal{D} \label{MP2} \\
&&& \sum_{r\in \mathcal{R}_e} x^r_e = 1 && \forall e \in \mathcal{E} \label{MP3} \\
&&& x^r_e\in \{ 0,1\} && \forall e \in \mathcal{E}, \forall r \in \mathcal{R}_e \label{MP4} \\
&&& 0 \leq s_d^- \leq u_d^- && \forall d \in \mathcal{D} \label{MP5} \\
&&& 0 \leq s_d^+ \leq u_d^+ && \forall d \in \mathcal{D} \label{MP6}
\end{align}
\end{document}
Antwort2
Dieses Layout ist auch mit dem entsprechenden Paket erhältlich optidef
. Ich habe die Nummerierung so geändert, dass die Einschränkungen Untergleichungen der ersten Zeile sind:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[short]{optidef}
\begin{document}
\begin{mini!}
{\qquad}{ \sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} c^r_e x^r_e + \sum_{d \in \mathcal{D}} c^-_d s_d^- + \sum_{d \in \mathcal{D}} c^+_d s^+_d \tag{1}}{\label{MP1}}{}
%
\addConstraint{}{\sum_{e\in \mathcal{E}} \sum_{r\in \mathcal{R}_e} a^r_{ed} x^r_e + s_d^- -s_d^+ = b_d\qquad }{\forall d \in \mathcal{D} \label{MP2}}
\addConstraint{}{\sum_{r\in \mathcal{R}_e} x^r_e = 1}{\forall e \in \mathcal{E} \label{MP3}}
\addConstraint{}{x^r_e\in \{ 0,1\}}{\forall e \in \mathcal{E}, \forall r \in \mathcal{R}_e \label{MP4}}
\addConstraint{}{0 \leq s_d^- \leq u_d^- }{\forall d \in \mathcal{D} \label{MP5}}
\addConstraint{}{0 \leq s_d^+ \leq u_d^+}{\forall d \in \mathcal{D} \label{MP6}}
\end{mini!}
\end{document}