1

I use the following packages already:

\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[bookmarks]{hyperref}
\usepackage{braket}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[numbers]{natbib}
\usepackage{scalerel}
\usepackage{stackengine}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{alltt}
\usepackage[multiple]{footmisc}

The relevant code so far is:

\begin{subequations}
\label{CanCommRelat}
\begin{align}
[ x_{i} ; x_{j} ] & = 0, \quad
\end{align}
\begin{align}
[ p_{i} ; p_{j} ] & = 0, \text{ and} \quad
\end{align}
\begin{align}
[ x_{i} ; p_{j} ] & = i \hbar \delta_{ij}
\end{align}
\end{subequations}

This numbers the subequations as intended, but I want them to be displayed in the same line. I realize, right now the \quad commands don't have any effect, but I would like the subequations to be separated by a bit of horizontal space each. All I could find were questions of how to put subequations in the same line WITH individual references, which I don't need. I would be nice to be able to reference the expression as a whole.

I suspect the packages I loaded already provide that possibility, but I'm just new to Latex.

  • 3
    Off-topic: The a4 and a4wide packages are obsolete and haven't been updated in decades. Consider using the geometry package (likely with options a4paper and margin=2.5cm). – Mico Apr 26 at 8:08
  • Can, please, edit your code why is it missing the \documentclass. Regards. – Sebastiano Apr 26 at 10:49
2

You wrote,

This numbers the subequations as intended, but I want [the subequations] to be displayed in the same line.

Something like this?

enter image description here

This solution works by placing three equation (not align) environments into three separate minipage environments.

Addendum, prompted by @Schrödinger'scat's follow-up comment: (a) For a general reference on employing minipage environments to typeset separate (sub)equations and their associated equation numbers, see this posting. (b) If there's text before and/or after this subequations environment, be sure to insert paragraph breaks (best by leaving blank lines) as well.

\documentclass{article}
%\usepackage{a4wide} % is obsolete, use 'geometry' instead
\usepackage[a4paper,margin=2.5cm,includehead]{geometry}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%\usepackage[bookmarks]{hyperref}% load this package *last*
\usepackage{braket}
\usepackage{mathrsfs}
\usepackage{mathtools}
%\usepackage{amsfonts}% is loaded by 'amssymb'
\usepackage{amssymb}
%\usepackage{amsmath} % is loaded by 'mathtools'
\usepackage[numbers]{natbib}
\usepackage{scalerel}
\usepackage{stackengine}
\usepackage{enumitem}
\usepackage{alltt}
\usepackage[multiple]{footmisc}
\usepackage[bookmarks]{hyperref}

\begin{document}

\begin{subequations}
\label{CanCommRelat}
\begin{minipage}[t]{0.28\textwidth}\begin{equation}
  [ x_{i} ; x_{j} ] = 0, 
\end{equation}\end{minipage}\hfill
\begin{minipage}[t]{0.28\textwidth}\begin{equation}
  [ p_{i} ; p_{j} ] = 0, 
\end{equation}\end{minipage}\hfill
\begin{minipage}[t]{0.34\textwidth}\begin{equation}
  \text{and }[ x_{i} ; p_{j} ] = i \hbar \delta_{ij}.
\end{equation}\end{minipage}
\end{subequations}

\end{document}
| improve this answer | |
  • 1
    I had this solution also at first before I reread the question. That's why I know that the spacing around this is not good, that is, if you add text below or above you need to correct the vertical spacing. And it would be great if you could mention this answer for the strategy. – user194703 Apr 26 at 8:56
  • @Mico Off-Topic: I deleted the lines that load amsfonts and amsmath, substituted a4wide by geometry and pulled bookmarks{hyperref} down, as you said. When I try to compile now, I get the error "Latex Error: Option clash for package hyperref: The package hyperref has already been loaded with options: [] There has now been an attempt to load it with options [bookmarks] I use texmaker on Linux, btw. – Markus Gratis Apr 26 at 11:49
  • 1
    got it - you edited just loading hyperref out as well – Markus Gratis Apr 26 at 11:52
  • @MarkusGratis = It's definitely considered good form to load a package only once. :-) – Mico Apr 26 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.