# \newcommand isn't working

I often use minipages aligned to the top using the package adjustbox and the code:

    \noindent\adjustbox{valign=t}{\begin{minipage}{0.5\linewidth}

\end{minipage}}%
\hfill

\end{minipage}}


I would like to create a command so I don't have to write that every time. I tried:

    \newcommand{\mini2}[4]{%
#2
\end{minipage}}
\hfill
#4
\end{minipage}}


I would like to write inside my document something like that

    \mini2{0.5}{0.5}{something}{something else}


to have two minipages vertically aligned to the top.

Problem: My \newcommand is not working, and I can't find why.

Thank you for your help.

• You cannot have numbers in the macro names. So \newcommand{\mini2}{...} won't work regardless of what ... is. – user121799 Oct 27 '18 at 17:42
• Tank you @marmot – Zanzi Oct 27 '18 at 18:11
• Besides that you cannot have digits in multi-letter-command-names your command doesn't use the argument #3 at all. Seems to be a typo/seems #2 is also used in the place where #3 should be used. Also make sure to end lines where LaTeX due to \endlinechar might place an undesired space with comment-chars (%). – Ulrich Diez Oct 27 '18 at 19:14

Following you idea, try the following

\newcommand{\minii}[4]{%
#3
\end{minipage}}
\hfill
#4
\end{minipage}}


However, I guess that the following suggestion would be a clearer code

\def\beginmini#1{%
\noindent
\begin{minipage}{#1\linewidth}
}

\def\endmini{%
\end{minipage}


And then you could simply

\beginmini{<your value>}