1

Starting from these MWE into two links

  1. How to place and number 3 short equations in one line? (Stefan Kottwitz's answer) with this MWE:

\documentclass[11pt,a4paper]{scrbook}
\usepackage{amsmath}
\usepackage{tabularx}
\begin{document}
\chapter{Equations}
See equations \eqref{eqn:1}, \eqref{eqn:2} and \eqref{eqn:3}.
\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}}
  \begin{equation}
  x_{1} = \frac{A-A_{0}}{\frac{1}{2}
    \cdot \left( A_{\mathrm{A}} - A_{\mathrm{a}} \right)}
    \label{eqn:1}
  \end{equation} &
  \begin{equation}
  x_{2} = \frac{B-B_{0}}{\frac{1}{2}
    \cdot \left( B_{\mathrm{A}} - B_{\mathrm{a}} \right)}
    \label{eqn:2}
  \end{equation} &
  \begin{equation}
  x_{3} = \frac{C-C_{0}}{\frac{1}{2}
    \cdot \left( C_{\mathrm{A}} - C_{\mathrm{a}} \right)}
    \label{eqn:3}
  \end{equation}
\end{tabularx}
\end{document}
  1. My previous question An elegant aspect for enumerate the equations of a book (Werner's answer) that that I have modified a bit,

enter image description here


\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
            left=3.2cm,right=1.5cm,headsep=10pt,
            a4paper]{geometry}  %%%%%%%%%%% <--------- added 
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} %%%%%%%%%%% <--------- added 
\definecolor{ocre}{RGB}{243,102,25} 
\usepackage{lipsum} %%%%%%%%%%% <--------- added 

%----------------------------------------------------------------------------------
%   Change number equations with sections
%----------------------------------------------------------------------------------
\usepackage{chngcntr}
\counterwithin{equation}{section}

\renewcommand{\theequation}{\thesection-\arabic{equation}}
\newcommand{\eqnnumsymbol}{\textcolor{ocre}{\reflectbox{\ding{228}}}}

\makeatletter
\newtagform{bbrackets}% <name>
  [\textbf]% Internal style
  {(}% Left bracket
  {\ifnum\pdfstrcmp{\@currenvir}{equation}=0
     \eqnnumsymbol%
   \else
     \ifnum\pdfstrcmp{\@currenvir}{align}=0
       \eqnnumsymbol%
     \fi
   \fi
   )}% Right bracket
\makeatother
\usetagform{bbrackets}

\begin{document}
\lipsum[3][1-7]

\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{equation}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{equation} &
\begin{equation}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{equation}
\end{tabularx}

\lipsum[2][1-4]


\end{document}

we observe that the enumeration in the same line goes out the margins. See (out with red arrows in the image). However, I would like something of this type that I have modified with paint for clarity of my question:

This possible output, however, must be achieved realized when two or more equations (with two-by-two equations on different rows).

Please, what are the possible solutions?

8
  • 1
    Add \noindent before \begin{tabularx}. (As it is already present in the first example cde in your question.)
    – leandriis
    Commented Aug 11, 2019 at 20:53
  • @leandriis Kindest. Hi, I thought it wouldn't help \noindent. The first one is solved. +1 for all.
    – Sebastiano
    Commented Aug 11, 2019 at 21:05
  • 1
    Suppose you have three equations on the same line. If I understand well, the leftmost equation should be numbered in its left, the rightmost on its right. But where should be placed the number of the middle equation?
    – Bernard
    Commented Aug 11, 2019 at 21:22
  • @Bernard Your comment is perfect. The equations must be two-by-two on same line.
    – Sebastiano
    Commented Aug 11, 2019 at 21:25
  • see, if tex.stackexchange.com/questions/467784/… gives solution which you looking for.
    – Zarko
    Commented Aug 11, 2019 at 22:34

1 Answer 1

3

I propose this (based on my solution to your previous question). Note you have to use an amsmath environment, i.e. replace equation with gather for instance.

\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
            left=3.2cm,right=1.5cm,headsep=10pt,
            a4paper]{geometry} %%%%%%%%%%% <--------- added
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} %%%%%%%%%%% <--------- added
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{lipsum} %%%%%%%%%%% <--------- added

%----------------------------------------------------------------------------------
% Change number equations with sections
%----------------------------------------------------------------------------------
\usepackage{chngcntr}
\counterwithin{equation}{section}

\renewcommand{\theequation}{\thesection-\arabic{equation}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Added
\makeatletter
\newcommand{\leqnomode}{\tagsleft@true\usetagform{larrowtip}}
\newcommand{\reqnomode}{\tagsleft@false}
\newcommand*{\compress}{\@minipagetrue}
\newcommand*{\depress}{\@minipagefalse}
\makeatother

\usepackage{nccmath}
\usepackage{adforn}
\newtagform{arrowtip}[\bfseries\sffamily]{\bfseries(}{\textmd{)}\,\textcolor{IndianRed3}{\Large\adforn{42}}}
\usetagform{arrowtip}
\newtagform{larrowtip}[\bfseries\sffamily]{\textcolor{IndianRed3}{\Large\adforn{43}}\,(}{)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\lipsum[3][1-7]

{\noindent\begin{tabularx}{\textwidth}{@{}>{\compress\leqnomode}X<{\depress}>{\compress}X <{\depress}@{}}
\begin{gather}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{gather} &
\begin{gather}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{gather}
\end{tabularx}}

\lipsum[2][1-4]

\begin{gather}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{gather}

\leqnomode
\begin{gather}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{gather}

\end{document} 

enter image description here

3
  • Excellent. Please, can you put into your code the part that have you added with %%%%%%%% <--------- added? Thus I confronted everything with my book code. Thank you very much.
    – Sebastiano
    Commented Aug 12, 2019 at 7:00
  • 1
    Done. As there already were older ` <-------- added` from your code, I wrote %%% Added on a separate line. The table preamble has changed too. Maybe it might be worth defining a new column type, say \renewcommand{\tabularxcolumn}[1]{>{\compress}p{#1}<{\depress}}\newcolumntype{E}{>{\leqnomode}X}.
    – Bernard
    Commented Aug 12, 2019 at 9:27
  • Thank you very much for all and....for your MWE.
    – Sebastiano
    Commented Aug 12, 2019 at 10:21

You must log in to answer this question.

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