1

I came across with this answer https://tex.stackexchange.com/a/299988 by John Kormylo that uses tikz to calculate distance to the page bound and put the tag there.

enter image description here

But his code is rather dedicated to that particular problem, so it's reasonable to make it via decoding @ symbol.

I was trying to understand how his code works myself, but couldn't achieve such a result. What I'm looking for is a simple one time solution that will put the desired text as it would flushright do anywhere in math mode.

2 Answers 2

0

Messing with tikz, I managed to achieve the desired result. With such a simple code, you will be able to put any text at the very edge of the page.

enter image description here

\documentclass{article}
\usepackage{amsmath}    % for demonstration with cases environment
\usepackage{showframe}  % only for page borders (frame)

\usepackage{tikz}
\usetikzlibrary{calc}

\tikzset{taglike/.style={remember picture, overlay, shift={({0,0}-|{$(current page.east)-(\oddsidemargin+\hoffset+1in-3pt,0)$})},anchor=base east}}

\begin{document}

\[
\begin{cases}
x+y=6\\
x^2+y^2 = 18 \tikz[taglike]\node{(simple text)};
\end{cases}
\]

\end{document}
0

enter image description here

Update

The flush left alignment of displayed equations is obtained using an environment that depends on one argument, a length. This length might be fixed in fact in the definition of the environment; it represents the necessary left shift for an equation (flegn is activated) to touch the left margin of the text.

The environment does not function for simple text, because there is a vertical shift that is used to have a nice vertical space in between the preceding text and the mathematical expression.

The code

\documentclass[11pt, a5paper]{article}
\usepackage[fleqn]{amsmath}

\newenvironment{fldisplay}[1]{%
  \begin{list}{}{%
    \setlength{\topsep}{0pt}%
    \setlength{\leftmargin}{#1}%
    \setlength{\rightmargin}{0pt}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\itemindent}{\parindent}%
    \setlength{\parsep}{\parskip}%
  }%
  \item[]\vspace{-2.6ex}}{\end{list}}

\begin{document}

The simplest linear Diophantine equation takes the form
\begin{fldisplay}{-1.6\parindent}
  \begin{equation}
    \label{eq:1}
    ax + by = c,
  \end{equation}
\end{fldisplay}
where $a$, $b$, and $c$ are given integers. The solutions are
described by the following theorem: [\ldots]

\end{document}

Below is the first version of the answer in which the question wasn't really addressed (for various reasons).

enter image description here

It is not clear to me if this is what you are looking for. If yes, then you can achieve the presentation using only fleqn option of the amsmath package, the \nonumber command in align environment, and some ad-hoc horizontal alignment for the third line of the equation for y.

Anyway, why should someone write down an equation like (1)? I don't even consider (3) from the example.

The code

\documentclass[11pt, a5paper]{article}
\usepackage[fleqn]{amsmath}
\usepackage{lipsum}

\begin{document}
\lipsum[2]

\begin{align}
  x = 1234[
  &(a+b) \nonumber \\
  &(c+d+e) \nonumber \\
  &(f+g)] 
\end{align}
\vspace{-6ex}
\begin{align}
  y
  &= 5[(h+i)+j] \nonumber \\
  &= 6[(k+l) \nonumber \\
  &\phantom{= 6[(} (m+n+o)]
\end{align}

\lipsum[3]
\end{document}
3
  • I don't need to numerate every equation, so I use \mathtoolsset{showonlyrefs=true} in order to put labels only if I'm referring them. This way I don't need to put \nonumber every single time. Also, my question is about setting any text at the very edge. You'd rather asked it in comments first.
    – antshar
    Commented May 19, 2021 at 19:41
  • Well, what is your question then? Is it, How can one obtain displayed equations that start at the left edge of the text margin? (For normal text, flushleft does the job). If yes, are you still interested in a simple way to achieve this? I can modify the answer and include a definition of a simple environment that does it.
    – Daniel N
    Commented May 20, 2021 at 10:38
  • Yes, please. It's always interesting to find out different approaches.
    – antshar
    Commented May 20, 2021 at 12:28

You must log in to answer this question.

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