4

I'd like to replicate the line of the framed equation (5.11): (ignore the text above):

enter image description here

that is, "place the word 'or' (or another word) on the same line as -- but maximally separated from -- the framed equation (5.11)".

For example, instead of having this:

enter image description here

I'd like to have:

enter image description here

EDIT

I tried using \shortintertext command from mathtools package but that's not what I'm looking for (I appreciate the help though!!)

8
  • 1
    In display math mode, equations (and included \text{}) are centered by default. If you want raggedleft in text mode, you use the ragged2e package environments and commands. Feb 3 at 0:31
  • 1
    You can use flalign and \rlap{or} in the first column,, or \phantom{\text{or}} in the right column. I supposed \shortintertext{or} takes up too much space. Feb 3 at 1:04
  • 2
    your text appears justified, with hyphenation not ragged, justified text with centred equations is the default Feb 3 at 1:43
  • 2
    Doesn't look ragged to me, but full justification as default.
    – gildux
    Feb 3 at 1:49
  • 1
    @gildux - The OP may be using the term "ragge[re]dleft" in a slightly unusual sense -- as in, some sentence fragment (here, the word "or") is to be placed on the far left of centered equation.
    – Mico
    Feb 3 at 2:11

2 Answers 2

8

"The customer is always right" is an old truism. However, this rule does have some exceptions.

The OP's request is just such case: By placing the word "or" on the same line as -- but maximally separated from -- the framed equation (5.11), the word "or" actually becomes nearly invisible and unnoticeable. Presumably, that is not the OP's intention.

I suggest that the OP load the mathtools package, employ an align environment to typeset to equations, and place the word "or" in a \shortintertext wrapper. That way, text and math are visually separated and remain equally visible.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{mathtools}  % for \shortintertext and \Aboxed macros
\usepackage{lipsum} % filler text
\usepackage{newtxtext,newtxmath} % optional: Times Roman text and math fonts
\counterwithin{equation}{section} % just for this example

\begin{document}
\setcounter{section}{5} % just for this example
\setcounter{equation}{10}

\noindent
\lipsum[1][1-3] % filler text
\begin{align}
\ln P &= -\gamma\ln V + \ln\text{const.} \notag \\
\shortintertext{or}
\Aboxed{PV^{\gamma} &= \text{const.}}
\end{align}
This equation of state holds for all equilibrium states through which the ideal \dots
\end{document}

Addendum to address the OP's follow-up comment: I suppose the OP's desired layout could be achieved by using (abusing!) an flalign environment; see the upper part of the screenshot below.

I can only hope that the OP will take @gildux's earlier comment

I thought the [word] "or" was part of the equation (or a cell of an equation array or something like that). The image looks strange...

to heart and decide against pursuing the flalign approach after all. Yes, the flalign "saves" a bit more than 1\baselineskip in vertical space expended on the document -- at the cost of producing something that's confusing or misleading (or both!). In short, the OP's desired layout is a sadly-excellent illustration of the old-time expression "penny-wise but pound-foolish". :-)

enter image description here

\documentclass{article}
\usepackage{mathtools}
\usepackage{newtxtext,newtxmath} % optional
\begin{document}
\hrule
\begin{flalign}
          && \ln P &= -\gamma\ln V + \ln\text{const.} & \notag \\
\text{or} && \Aboxed{PV^{\gamma} &= \text{const.}}    &
\end{flalign}
\hrule
\smallskip
\noindent vs.
\smallskip
\hrule
\begin{align}
\ln P &= -\gamma\ln V + \ln\text{const.} \notag \\
\shortintertext{or}
\Aboxed{PV^{\gamma} &= \text{const.}}
\end{align}
\hrule
\end{document}
3
  • 1
    Nice, even if the "or" isn't on the same line as the boxed equation. +1 Well, that looks very strange but "The customer is always right" :D
    – gildux
    Feb 3 at 3:42
  • Your solution works great in placing the text where I want it. Although, I still need the equation on the same line as the text. Is that possible?
    – Peluche
    Feb 3 at 4:09
  • 1
    @Peluche - Please see the addendum I posted just now.
    – Mico
    Feb 3 at 6:00
2

You can center both equations, with some pain.

\documentclass{article}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}

\usepackage{lipsum} % filler text

\counterwithin{equation}{section} % just for this example

\begin{document}

\setcounter{section}{5} % just for this example
\setcounter{equation}{10}

\noindent
\lipsum[1][1-3] % filler text
\begin{equation*}
\ln P = -\gamma\ln V + \ln\text{const.}
\end{equation*}
\noindent
\begin{equation}
\hspace{-0.5em}\makebox[0pt][l]{or}
\settowidth{\dimen0}{\theequation}%
\hspace{\dimen0}\quad
\hspace{1000pt minus 1fil}
\boxed{PV^{\gamma} = \text{const.}}
\hspace{1000pt minus 1fil}
\end{equation}
This equation of state holds for all equilibrium states through which the ideal

\end{document}

enter image description here

However, I'd not pursue this strategy, because “or” doesn't belong to the equation.

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{newtxtext,newtxmath}

\usepackage{lipsum} % filler text

\counterwithin{equation}{section} % just for this example

\begin{document}

\setcounter{section}{5} % just for this example
\setcounter{equation}{10}

\noindent
\lipsum[1][1-3] % filler text
\begin{gather}
\ln P = -\gamma\ln V + \ln\text{const.}\notag \\
\shortintertext{or, in different form,}
\boxed{PV^{\gamma} = \text{const.}}
\end{gather}
This equation of state holds for all equilibrium states through which the ideal

\end{document}

enter image description here

You must log in to answer this question.

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