3

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...

Christoph
  • 331

2 Answers2

6

You are referring to the right 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}

daleif
  • 54,450
  • 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
1

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.
Cragfelt
  • 4,005
  • 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 (https://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