3
\color{blue}$1 - \text{q}^\text{n} \geq \text{P$_S$} | - 1 \\
\text{q}^\text{n} \geq  -1 + \text{P$_S$} | : (-1) \\
\text{q}^\text{n} \geq 1 - \text{P$_S$} |\, \text{ln}(...) \\
\text{n}\cdot \text{ln}(\text{q}) \geq \text{ln}(1 - \text{P$_S$}) | : \text{ln}(\text{q}) \\
\text{n} \geq \frac{\text{ln}(1 - \text{P$_S$)}}{\text{ln}(\text{q})}$

enter image description here

How can I make this look cleaner/more aligned?

F. Pantigny
  • 40,250
  • 2
    is this not duplicate of your earlier question https://tex.stackexchange.com/questions/657386/how-can-you-make-equations-more-aligned why tagged as biblatex? – David Carlisle Sep 19 '22 at 16:27
  • 3
    Off topic: you have answers with formatting hints, but please check the content... Inequalities change direction sometimes.... ;-) – Rmano Sep 20 '22 at 05:50

4 Answers4

9

I guess that you after something like this:

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document} [ \begin{alignedat}{2} 1 - q^n & \geq P_S &\quad& | - 1 \ -q^n & \geq -1 + P_S && |\times (-1) \ q^n & \leq 1 - P_S && | \ln({\dots}) \ n \cdot \ln(q) & \leq \ln(1 - P_S) && |\div \ln(q) \ n & \leq \frac{\ln(1 - P_S)}{\ln(q)} \end{alignedat} ] \end{document}

I took a liberty and turn your math to usual way to wrote math and also correct one math error ...

Edit (1):

  • Considered is @Sigure comment (thank you very much!).
  • If for some reason you like to have this math evaluation in the blue color, than you can obtain this with the following changes of the above MWEČ
\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\begin{document} [\color{blue} \begin{alignedat}{2} % rest is the same as is above MWE

enter image description here

Edit (2): Considered is @Mico comment (thank you very much!)

Edit (3): Considered is @Rmano comment (thank you very much!)

Zarko
  • 296,517
  • I'd use \ln({\dots}) to have balanced space around the dots. – Sigur Sep 19 '22 at 16:51
  • @Sigur, thank you very much for editing code and for tips. Considered in edited answer. – Zarko Sep 19 '22 at 16:52
  • 2
    +1 for getting rid of all \text wrappers. You may want to also replace : (-1) with \times(-1) and : \ln(q) with \div \ln(q). – Mico Sep 19 '22 at 17:15
  • 1
    @Mico, thank you very much! I considered your tips in edited answer. – Zarko Sep 19 '22 at 17:29
  • thank you so much! – user279680 Sep 19 '22 at 17:36
  • @user279680, you are welcome. BTW, if received answers solve your problem, you may consider to accept (by clicking on check mark at top left side of answer) one, which you the most like. As I see, so far you not accept no one answer on your questions (and by this inform audience here, that your questions so far was not solved. Is this a true? – Zarko Sep 19 '22 at 19:28
  • OT: Shouldn't you change the direction of the inequality when multiplying by -1? 3≥2 but -3≤-2... – Rmano Sep 19 '22 at 20:03
  • 1
    @Rmano, oh, this math evaluation is erroneous ... I didn't check whole evaluation. Hopefully now will be correct ... – Zarko Sep 19 '22 at 22:00
7

In OpTeX, you can use \eqalign macro:

$$ \Blue
\eqalign{
       1 - q^n &\ge P_S        &&& | - 1 \cr
          -q^n &\ge P_S - 1    &&& | \times (-1) \cr 
           q^n &\le 1 - P_S    &&& | \ln (\dots) \cr
  n\cdot\ln(q) &\le \ln(1-P_S) &&& | \div \ln(q) \cr
             n &\le {\ln(1-P_S \over \ln(q)} 
}
$$

\bye

The result is the same as in the Zarko's answer.

Note that OpTeX provides extended \eqalign macro, it allows more than single column of equations. The second column can be inserted after && and we use its right part of the second column of equations for the | -1 etc., hence there are three &&&. See the document OpTeX math, page 27, for more details.

wipet
  • 74,238
  • 2
    It seems that somebody systematically down votes my answers where OpTeX is mentioned. I do such answers only if it is good for comparison of the code in discussed case and for sake of complexity (like here) or if the question does not mention LaTeX explicitly (like there: https://tex.stackexchange.com/questions/657658/l) or the problem is independent of used macro package (like there: https://tex.stackexchange.com/questions/49043/). By the way, we are still waiting for LaTeX answer in the second mentioned case. – wipet Sep 21 '22 at 06:13
3
\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}
\begin{equation}
{\color{blue}
\begin{aligned}
1 - q^n      & \geq P_S | - 1                   \\
q^n          & \geq -1 + P_S|:(-1)              \\
q^n          & \geq 1 - P_S |\, \ln(\ldots)     \\
n\cdot\ln(q) & \geq \ln(1 - P_S)|:\ln(q)        \\
n            & \geq \frac{\ln(1 - P_S)}{\ln(q)}
\end{aligned}}
\end{equation}
\end{document}

enter image description here

Clara
  • 6,012
2

Variables in math formulas are traditionally typeset in italics, in order to better distinguish them from text letters. So you shouldn't use all those \text commands, but just let TeX do its job.

Also \text{ln} is wrong (and I'm not talking about the symbol for the logarithmic function) and should be \ln.

Now, the “more aligned” depends on individual tastes. You might want that the main formulas are left aligned or that they're aligned with respect to the relation symbols therein.

Personally, I'd not add the indication of the operations performed in order to go from a line to the next, because they're rather elementary. Anyway, here are two ways to get what you want.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\begin{document}

[\color{blue!90!black} \begin{alignedat}{2} 1 - q^n & \geq P_S &\quad& |+(-1) \ -q^n & \geq -1 + P_S && |\times(-1) \ q^n & \leq 1 - P_S && |;{\ln({\dots})} \ n\ln(q) & \leq \ln(1 - P_S) && |;/!\ln(q) \ n & \leq \frac{\ln(1 - P_S)}{\ln(q)} \end{alignedat} ]

\end{document}

enter image description here

With left alignment:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\begin{document}

[\color{blue!90!black} \begin{alignedat}{2} &1 - q^n \geq P_S &\quad& |+(-1) \ &{-q^n} \geq -1 + P_S && |\times(-1) \ &q^n \leq 1 - P_S && |;{\ln({\dots})} \ &n\ln(q) \leq \ln(1 - P_S) && |;/!\ln(q) \ &n \leq \frac{\ln(1 - P_S)}{\ln(q)} \end{alignedat} ]

\end{document}

enter image description here

Actually, you should recall for the last step that q > 1, otherwise the step would be incorrect.

egreg
  • 1,121,712