3

this question has been asked before but I never saw a "perfect" solution for this problem.

I use the equation block for my equations and I want the definition of the variables to show at the right, next to the equation number, not next to the equation. I have managed this (by accident) for two of my equations that stand together in one align block.

right alignment

\begin{align}
f(n) &= 8,199 \times 10^{-6} n + 8,418 & \{n \in \mathbb{N}\} \label{equ:Laufzeit} \\
t_e &\leq \frac{t_i}{5} & \{t_e \in \mathbb{Q}^+\},\;\{t_i \in \mathbb{N}\;|\;5f(n) \leq t_i \leq +\infty\} \label{equ:MinInterval}
\end{align}

But for my other equation i can't make it work...I think it would look "cleaner" if they would all align right

wrong alignment

\begin{equation}
t_e \leq \frac{t_i}{5} \quad \{t_e \in \mathbb{Q}^+\},\;\{t_i \in \mathbb{N}\} \label{equ:MaxAusführungszeit}
\end{equation}

Its just a style thing so not that urgent but I would like to know if there is a sulution.

Tanks :)

  • what is the desired positioning of the left side of the one-line display? it's clear that you want the right side to end uniformly flush right at some fixed distance from the label, but the positioning of the left side isn't clear. (please add this description to the question, where it will be more readily seen than in a comment.) – barbara beeton Jul 29 '15 at 14:23
  • That is kind of tricky too...The equation should be displayed centered as long as it's not bumping into the definition of the variables. It should have a minimum margin to the definition. If that can't be matched with centering the equation it has to move to the left until the margin is correct – PowderFan Jul 30 '15 at 7:25
4

You can try with flalign

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\noindent Some equations:
\begin{flalign}
&& f(n) &= 8,199 \times 10^{-6} n + 8,418 & \{n \in \mathbb{N}\} \label{equ:Laufzeit} \\
&& t_e &\leq \frac{t_i}{5} & \{t_e \in \mathbb{Q}^+\},\;\{t_i \in \mathbb{N}\;|\;5f(n) \leq t_i \leq +\infty\} \label{equ:MinInterval}
\end{flalign}

\begin{flalign}
&& t_e \leq \frac{t_i}{5} && \{t_e \in \mathbb{Q}^+\},\;\{t_i \in \mathbb{N}\} \label{equ:MaxAusführungszeit}
\end{flalign}

\end{document} 

enter image description here

  • THAT IS IT!!! Thank you sooo much. Now my equations look clean and nice. Another style issue that hurted my eyes solved. :D – PowderFan Jul 30 '15 at 7:33
0

Why don't use align for both purposes? align is totally fine also for a single equation

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\begin{document}
\begin{align}
t_e &\leq \frac{t_i}{5} && \{t_e \in \mathbb{Q}^+\},\;\{t_i \in \mathbb{N}\} \label{equ:MaxAusführungszeit}
\end{align}
\end{document}

aligned equation

  • Except that it might add more space above and below it than equation, see align vs equation – Torbjørn T. Jul 29 '15 at 7:37
  • for me that is more of a reason to use align because you will use it eventually and this way the spacing is consistent, but it is a valid point, @TorbjørnT . – Bort Jul 29 '15 at 7:41
  • For me there is no diference between using align with multiple & and putting lots of \quad commands in an equation block. The result woun't be the same for every equation. Also if I use \quad or & in align the equation itself will shift more and more to the left cause latex is trying to center the whole thing...sort of... And align makes perfect sense if there are multiple equations (to align the equal chars) but if there is only one equation there is nothing to align it to... – PowderFan Jul 29 '15 at 8:31
  • @user3237363 I was talking about vertical spacing. If you want consistency horizontally read up on the fleqn option – Bort Jul 29 '15 at 8:33
  • hmmm...Not sure if that is a fit either...I think the real problem is that I have two parts of one line so to speek. the equation has to be centered (as far as it works out without running into the definition...then it has to move more to ne left). The definition has to be aligned right with a little margin to the equation number...and I don't know if it is even possible to have two parts of one line aligned differently... – PowderFan Jul 29 '15 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.