I have asked before, but I never got the answer I was looking for. (old question is here: Defining a new figure environment)
As the title suggests I'm looking for a way to make 2 images stand side by side by defining a new environment, not a command.
The example is the same as the old question: How can I define a new environment, that makes 2 images stand side by side
This is what I have tried without it working.
\documentclass[a4paper,11pt,fleqn,twoside,openright]{memoir}
\usepackage{caption}
\usepackage{graphicx,caption}
\usepackage{float}
\newenvironment{sidebyside}[6]{
\begin{figure}[H]
\centering
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics[width=\textwidth]{Lists/Images/#1}
\caption{#2}
\end{subfigure}
%
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics[width=\textwidth]{Lists/Images/#3}
\caption{#4}
\end{subfigure}
\caption{\protect\raggedright #5}
\label{#6}
\end{figure}
}
The sole reason I want it as an environment, is because I'm working with people who doesn't understand LaTeX coding, so I need to make it as easy for them as possible.
Edit for clarification:
When the user types "\begin{sidebyside}
" and presses enter, (s)he should see the following code pop up:
\begin{sidebyside}
\begin{figure}[H]
\centering
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{}
\caption{}
\end{subfigure}
%
\begin{subfigure}[b]{0.49\textwidth}
\includegraphics{}
\caption{}
\end{subfigure}
\caption{\protect\raggedright }
\label{}
\end{figure}
\end{sidebyside}
Edit 2:
Apparently my question is still hard to understand. So I've recorded what I'd want to happen here: https://youtu.be/vEBT6Z5TwJQ
EDIT FINAL:
I understand now, that the LaTex editors most people use, obviously isn't like the online solutions. This question is based on my inexperience with the editors, and was rooted in the online editor Overleaf, which has some luxurious shortcuts and autocompleting commands and environments, which obviously doesn't apply in the 'regular' editors. So I understand now why it was hard to understand.
Best Answer
Here's an
environment
-based solution.That said, I agree with @TeXnician that a macro-based solution seems far more natural and at least as straightforward to implement. First the command definition:
Second, a way to call the command: