1

I'm looking for a way to achieve the same output (regarding the alignment of matrix entries) using the physics package - or simply a conformation that will work only with mathtools (like here). Either way, thx in advance.

\documentclass{standalone}
\usepackage{mathtools}
\usepackage{physics}

% workaround found by adding an optional argument to the original code
% (note the xparse package was already loaded with physics)
\DeclareDocumentCommand\pmqty{O{r} m}{\begin{pmatrix*}[#1]#2\end{pmatrix*}} % adjusted
%       VS
% \DeclareDocumentCommand\pmqty{m}{\begin{pmatrix}#1\end{pmatrix}}  % original
\DeclareDocumentCommand\pmqtyOld{m}{\begin{pmatrix}#1\end{pmatrix}} % for comparison

\begin{document}
    $\begin{pmatrix*}[r]
    -1 & 3 \\
    2 & -4
    \end{pmatrix*}$

    $\pmqtyOld{
        -1 & 3 \\
        2 & -4
    }$

    $\pmqty{
        -1 & 3 \\
        2 & -4
    }$
\end{document}

enter image description here

Venez
  • 611
  • Could you please clarify your question ? what ouput is expected ? Is the use of the vastly debated physics package really needed ? – Jhor Apr 24 '20 at 10:15
  • I want to achieve the output on the left side, but atm i have that one on the right side. PS: vastly debated, so is there already an equally alternative? – Venez Apr 24 '20 at 10:50
  • as a Physicist, i never use this package. Vastlly debated means , e.g. Alternatives to the physics package (https://tex.stackexchange.com/questions/471532/ and references in it). What is the problem with he mathtools solution ? – Jhor Apr 25 '20 at 16:56
  • Whare abouit `newcommand\Pmqty[1]{\begin{pmatrix}[r] #1 \end{pmatrix}}

    [ \Pmqty{-1 & 3 \ 2 & -4} ]` ??

    – Jhor Apr 25 '20 at 17:05
  • Hmm... to be honest, i do not want to change the package on the last mile of writing - however, i cannot ignore the ugliness in specific equations ^^# PS: in your last remark i found the way to go for me, thx (and for the future i will consider to switch to other packages ^_~) – Venez Apr 27 '20 at 11:31

0 Answers0