3

I am looking for an elegant way to achieve the following display, in which consecutive lines in math-mode have opposite justifications:

pic

I was able to do so using the following hack

\documentclass[12pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{flalign*}
a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 +a_5 x^5 + a_6 x^6 \leq f(x) + g(x)+ h(x)    &&
\end{flalign*}
\vspace{-0.4in}
\begin{flalign*}
&& \leq 
b_0 + b_1 x + b_2 x^2 + b_3 x^3 + b_4 x^4 +b_5 x^5 + b_6 x^6,
\end{flalign*}

\end{document}

Can this be achieved with a single align-type environment?

2
  • 2
    Welcome to TeX.SE. It strongly depends on your definition of elegant. Please describe more what you want to achieve.
    – Roland
    Nov 30, 2021 at 1:43
  • multline* (amsmath) sort of does that, but it doesn't go quite all the way to the edge. Nov 30, 2021 at 19:58

2 Answers 2

6

Try this:

\documentclass[12pt]{article}
\usepackage{mathtools}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\[
\begin{multlined}[\linewidth]
a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 +a_5 x^5 + a_6 x^6 \leq f(x) + g(x)+ h(x)\\
%
\leq b_0 + b_1 x + b_2 x^2 + b_3 x^3 + b_4 x^4 +b_5 x^5 + b_6 x^6,
\end{multlined}
\]
\end{document}

enter image description here

(red lines indicate text borders)

Is this what you after?

0

You could overlap the lines.

\documentclass[12pt]{article}
\usepackage{mathtools}

\begin{document}

\begin{flalign*}
\mathrlap{a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 +a_5 x^5 + a_6 x^6 \leq f(x) + g(x)+ h(x)}&&\\
&&\mathllap{\leq 
b_0 + b_1 x + b_2 x^2 + b_3 x^3 + b_4 x^4 +b_5 x^5 + b_6 x^6,}
\end{flalign*}

\end{document}

You must log in to answer this question.

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