# How to use horizontal fill in math mode for LyX

I am in math mode and I would like to push text (that justifies a step in an equation) to the end of the page. Usually I would apply "Horizontal Fill"; however, this option is removed when I am in math mode. For example, I would like to push the expression (by (3)) to the margin of the page. Here is the source for my chain of equations.

\begin{eqnarray*}
\text{Hdim}K_{0}\left(\theta\right) & \le &
\limsup_{i\to\infty}\frac{\log\#\sigma\left(\alpha\right)}{\log n_{k_{i}+1}-\log
n_{k_{i}}}\\
& = & \limsup_{i\to\infty}\frac{\log a_{k_{i}+1}}{\log n_{k_{i+1}}-\log
\end{eqnarray*}


MWE: I would like expressions used to justify steps in a chain of equations/inequalities to appear on the right margin just as (3) does in the following pdf image Here is the Latex Source for this example.

\begin{lem}
\begin{doublespace}
\textup{Let $\alpha\in J$ and $k=\left|\alpha\right|$.}
\begin{equation}
\#\sigma\left(\alpha\right)\le a_{k+1}
\end{equation}
\end{doublespace}
\end{lem}

• Well actually your caption don't let me see well the equations for understand better your issue. Could you bring us a Minimal Working Example of your document for understand you better? – Aradnix Apr 29 '14 at 2:17
• I've added the Latex Source from my LyX document. – The Substitute Apr 29 '14 at 2:25
• I asked for a whole minimal working example, not only a portion of the document, but I see you don't use the amsmathpackage or another that improve and ease the work with mathematical equations. I have few ideas, but without a MWE perhaps will be better wait. – Aradnix Apr 29 '14 at 23:19

Use the \tag* macro from amsmath:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
y &= f(x) \tag*{foo}
\end{align}

\end{document}


You can insert it inside LyX with Ctrl-L (Eval Red Text) as LaTeX code: LyX inserts the backslash and insert tag*{foo} which will then be collapsed to: However, do not use the environment eqnarray, it has a lousy formatting. Use environment align instead.

• Where should the code be inserted, and does it start at \begin or \documentclass{article}? My document class is aricle, and I included the \usepackage{amsmath} to my latex preamble, but I am not sure where/how to implement this. I'm not sure if ERT works in math mode, and I cannot generate a pdf when I paste this code in ERT. – The Substitute Apr 30 '14 at 6:23
• Write your equation as usual and at the end of the equation – user2478 Apr 30 '14 at 6:40
• Herbert, I see how to use this code if my chain of equalities is 1 line, but where to I insert this code if I have a vertical chain of equalities and I want "foo" to appear in one of the rows? – The Substitute Apr 30 '14 at 11:06
• then at the end of that row – user2478 Apr 30 '14 at 17:22