Math & SciencePlacement of "comma"/"point" between 2 lines of equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
juk80
Posts: 4
Joined: Thu Jun 23, 2022 3:16 pm

Placement of "comma"/"point" between 2 lines of equations

Post by juk80 »

Hi everybody,

I use the following code to define math operations, here a group operation.

Code: Select all

Code, edit and compile here:
%preamble: centers content in an alignat cell, instead of left/right alignment
\newcommand*\centermathcell[1]{\omit\hfil$\displaystyle#1$\hfil\ignorespaces}
% usage in text: definition of a binary operation with subequation label on each line
\begin{subequations}
\begin{alignat}{5}
& \circ && \ :\quad && \centermathcell{G \times G } && \centermathcell{\quad\to\quad} && G\\
& && && \centermathcell{(g, h)} && \centermathcell{\quad\mapsto\quad} && g \circ h := \circ(g, h)
\end{alignat}
\end{subequations}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I like the style, but sometimes I need a "comma" or a "point" at the end of the definition (somehow between the 2 lines) in order to integrate it with the text flow (see pic attached, highlighted in yellow).
Can anyone help me with the placement of the "comma"/"point" at the end of the definition and still have the sub equation labels on each line.

Thx in advance.

Kind regards,
Jens
Attachments
output.PNG
output.PNG (10.99 KiB) Viewed 58569 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Placement of "comma"/"point" between 2 lines of equations

Post by MjK »

Please always try to make a Infominimal working example instead of showing only a code snippet.

To place the comma between the line, you could add a \raisebox after the longest line:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{amsmath}
\newcommand*\centermathcell[1]{\omit\hfil$\displaystyle#1$\hfil\ignorespaces}
\begin{document}
\begin{subequations}
\begin{alignat}{5}
& \circ && \ :\quad && \centermathcell{G \times G } && \centermathcell{\quad\to\quad} && G\\
& && && \centermathcell{(g, h)} && \centermathcell{\quad\mapsto\quad} && g \circ h := \circ(g, h)\smash{\text{\quad\raisebox{.5\baselineskip}{,}}}
\end{alignat}
\end{subequations}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
However, I would not add the comma centered, but just at the end of the last line:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{amsmath}
\newcommand*\centermathcell[1]{\omit\hfil$\displaystyle#1$\hfil\ignorespaces}
\begin{document}
\begin{subequations}
\begin{alignat}{5}
& \circ && \ :\quad && \centermathcell{G \times G } && \centermathcell{\quad\to\quad} && G\\
& && && \centermathcell{(g, h)} && \centermathcell{\quad\mapsto\quad} && g \circ h := \circ(g, h)\text{\enskip,}
\end{alignat}
\end{subequations}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
juk80
Posts: 4
Joined: Thu Jun 23, 2022 3:16 pm

Placement of "comma"/"point" between 2 lines of equations

Post by juk80 »

Thx MjK, this will work.
You are, of course, right about the minimal working example - duly noted!
Post Reply