1

I want to right-align everything, but it does not seem to work inline:

\documentclass[12pt]{article}

\usepackage{a4wide, fancyhdr}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}    
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage[parfill]{parskip}
\usepackage{enumerate}
\usepackage{framed}
\usepackage{xcolor}

\begin{document}

Matrix $A=\left(\begin{smallmatrix}[rr] 2 & -2\\ -1 & 4 \\ 0 & 6\end{smallmatrix}\right)$ 
or this $\vec{a}=\left(\begin{smallmatrix}[r] x \\ -3 \\ 5\end{smallmatrix}\right)$ ...text...

\end{document}

Any thoughts? This does not help...

  • Please add a complete MWE. – epR8GaYuh Oct 18 '18 at 11:18
  • Are you even using mathtools, if you are you are not asking it to be right aligned. As mentioned, provide a full minimal exmaple not just a sniplet – daleif Oct 18 '18 at 11:27
  • @epR8GaYuh See my edit... – Christoph Oct 18 '18 at 11:27
  • The answer you refer to mentions mathtools explictly, you are not using it.... simple as that – daleif Oct 18 '18 at 11:28
  • plus a4wide is not a recommended package. – daleif Oct 18 '18 at 11:29
3

You are referring to theright answer, just use it correctly

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

Matrix $A=\begin{psmallmatrix*}[r] 2 & -2\\ -1 & 4 \\ 0 & 6\end{psmallmatrix*}$ 
or this $\vec{a}=\begin{psmallmatrix*}[r] x \\ -3 \\ 5\end{psmallmatrix*}$

\end{document}
| improve this answer | |
  • Can I ignore package a4wide? – Christoph Oct 18 '18 at 11:43
  • @Christoph yes, learn to use the geometry package to set proper margins (or what ever the interface of the class you are using offers, article has none, though do remember the a4paper class option, the default is US letter) – daleif Oct 18 '18 at 12:35
0

Using \hfill is a much easier solution, for example:

\left\{ \begin{smallmatrix} 
x^3+y^3+z^3 \hfill & = & 1 \\ 
x^2+y^2+z^2 \hfill & = & 0 \\ 
x^3+x^2+y+z \hfill & = & -1 
\end{smallmatrix} \right.
| improve this answer | |
  • What do you mean? Where should I use \hfill? – Christoph Sep 21 '19 at 16:10
  • 1
    Example:\left\{\begin{smallmatrix} x^3+y^3+z^3\hfill&=&1\\ x^2+y^2+z^2\hfill&=&0\\ x^3+x^2+y+z\hfill&=&-1 \end{smallmatrix}\right. Of course I needed it to display equations – Just Someone Sep 21 '19 at 16:11
  • 5
    Please add that example directly into the answer, comments are easily missed. Fleshing out the example to a full MWE (tex.meta.stackexchange.com/q/228/35864) and adding a picture of the output are a nice touch (though by no means a must). I would say that in its current form without further explanation about where the \hfill ought to go, the answer needs some work. – moewe Sep 21 '19 at 16:57

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.