7

I googled it and I couldn't found it. And I am really sure this is a question that a lot of people ask, but I really googled it and couldn't find it.

Is it possible to use an "invisble equal sign" in the align environment? Some times I would like align to align equations different, instead of under the equation mark. In some formulas I don't have equation signs. So is it possible to use an invisible equation mark or some trick to align to something else than an equation mark?

Here a minimal example. I would like to have the last two "equations" aligned (I just wrote some random numbers, to make an example). The first two environments was to show how I normally use align/equation.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}
%Normal use of align
\begin{align}
    x &= 0.999\ldots \\
10x &= 9.999\ldots \\
   10x &= 9+0.999\ldots \\
   10x &= 9 + x\\
   9x &= 9\\
    x &= 1
\end{align}

%Normal use of equation
\begin{equation}
0.999\ldots = 9\left(\tfrac{1}{10}\right) + 9\left({\tfrac{1}{10}}\right)^2 + 9\left({\tfrac{1}{10}}\right)^3 + \cdots = \frac{9\left({\tfrac{1}{10}}\right)}{1-{\tfrac{1}{10}}} = 1.\,
\end{equation}

%What I would like to have aligned
\begin{align}
bci-ax+i > n\\
\sin(\theta_B) \rightarrow 9x
\end{align}
\end{document}

Kind regards!

4
  • 2
    You can align prepending & to any character to serve as alignment point. How would you like the alignment to be in your code? Commented Mar 11, 2015 at 20:47
  • @GonzaloMedina Thank you very much! That is the answer ... thought you just have to use it on = ... Commented Mar 11, 2015 at 20:50
  • @BasiliusSapientia instead of thanks, you might consider accepting the answer : ). Commented Mar 11, 2015 at 20:59
  • @aeroNotAuto would like to, but (as far as I know) it is impossible to except the answer when the correct answer is in the commend. Or am I wrong? I can just except something that is given as "answer" and not as commend. Commented Mar 11, 2015 at 21:07

2 Answers 2

4

The use of & is not restricted to the equality symbol. You can align prepending & to any character to serve as alignment point:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

No alignment:
\begin{gather}
bci-ax+i > n\\
\sin(\theta_B) \rightarrow 9x
\end{gather}

Alignment at \verb+>+ and \verb+\rightarrow+:
\begin{align}
bci-ax+i &> n\\
\sin(\theta_B) &\rightarrow 9x
\end{align}

\end{document}

enter image description here

1
  • 1
    The question was whether an invisible &= can be used. This serves the OP's purpose, but doesn't answer the question. Commented Sep 29, 2019 at 16:43
0

Right now I'm messily using \hphantom{\,\,\,\,\,\,\,\,}. Hopefully someone has a better solution.

\begin{align*}
    P(SX < k)
    &= P(SX < k \mid S = 1)P(S = 1) + P(SX < k \mid S = -1)P(S = -1)\\
    &= (e^{k})(0.5) \text{ (if } k < 0 \text{)}\\
    &\hphantom{\,\,\,\,\,\,\,\,} (1 - e^{- k})(0.5) + (1)(0.5) \text{ (if } k > 0 \text{)}\\
    &= (e^{k})(0.5) \text{ (if } k < 0 \text{)}\\
    &\hphantom{\,\,\,\,\,\,\,\,} 1 - \frac{1}{2}e^{- k} \text{ (if } k > 0 \text{)}
\end{align*}
5
  • This is an answer. It aligns the equations without there actually being an equals sign.
    – Pro Q
    Commented Oct 28, 2020 at 22:06
  • 1
    Why \hphantom? \, just makes blank space; I'd say that \mspace{24mu} is better, anyway. Also \,|\, is not really good: it should better be \mid.
    – egreg
    Commented Oct 28, 2020 at 23:16
  • 1
    And the awkward \text combinations might be simpler: \text{ (if $k<0$)}
    – egreg
    Commented Oct 28, 2020 at 23:22
  • 1
    Sorry for the misunderstanding: as you use a different equation than the OP I thought you were doing something else.
    – campa
    Commented Oct 29, 2020 at 9:34
  • @egreg The answers as to why I did things the way I did is that I'm bad at LaTeX :P However, I, too, was wondering what the answer to this question was, and came up with a (really bad) answer, and decided to post it because sometimes when a (really bad) answer is posted, it gets (really good) people to pay attention so that a better answer is found.
    – Pro Q
    Commented Oct 29, 2020 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .