# representation of vector and matrix in latex

i'm working on my latex thesis and i want to represent this equation, matrix is upperCase letter with 2 lines under it, and vector just one line below, see the picture attached

can someone help me out with a way to represent it

• that seems very much a "blackboard" notation, do you really want that in a typeset paper? (\underline{.} and \underline{\underline{.}} probably do what you want but.... – David Carlisle Apr 17 at 20:57

The immediate problem can be solved with an array, with a local setting of \arraystretch for reducing the gap between the two rows.

\documentclass{article}
\usepackage{amsmath,bm}

% old fashioned notation for the old fashioned supervisor
\newcommand{\vect}[1]{\underline{#1}}
\newcommand{\matr}[1]{\underline{\underline{#1}}}

% better for typesetting
%\newcommand{\vect}[1]{\mathbf{#1}} % or \bm
%\newcommand{\matr}[1]{\mathbf{#1}} % or \bm

\begin{document}

Here $\vect{Q}$ and $\vect{w}$ are column vectors and $\matr{A}$ is a matrix
$\renewcommand{\arraystretch}{0.7} \begin{array}{@{} c @{} c @{} c @{\;} c @{}} \vect{Q} & {}={} & \matr{A} & \vect{w} \\ \scriptscriptstyle m\times 1 && \scriptscriptstyle m\times n & \scriptscriptstyle n\times 1 \end{array}$

\end{document}


I strongly advise to use macros for inputting matrices and vectors. When your supervisor will realize that the old-fashioned notation is also very ugly in print (it was used in the typewriter times), you can simply change the definitions. If you switch the comments in the code above, the result will be

without changing the code in the document body.

• thank you so much that's exactly what i'm searching for, i appreciate your help – sana ch Apr 17 at 23:06

The notational possibilities are sheer endless. Which notational practice you wish to adopt may be dictated by typographic conventions specific to a field, a language, a country, etc. LaTeX and TeX don't prescribe any particular notational practice.

The following screenshot shows five possibilities; I have no doubt that there are many more. Echoing a thought already expressed by David Carlisle, "blackboard-style" notational conventions (e.g., with one or two underlines) are not necessarily the best when applied to typeset, as opposed to hand-written, material.

\documentclass{article}
\usepackage{amsmath,bm}
\begin{document}

\begin{align*}
Q &= Aw \\
\mathrm{Q} &= \mathrm{A}\mathrm{w}\\
\mathbf{Q} &= \mathbf{A}\mathbf{w}\\
\vec{Q} &= A\vec{w}\\
\bm{Q} &= \bm{A}\bm{w}
\end{align*}
\end{document}

• thank you for your reply, i share the same opinion as you, i think it's a blaskboard notation but my supervisor insist to do it this way in my thesis – sana ch Apr 17 at 21:29
• @sanach - If your supervisor is so strongly wedded to this borderline unsuitable typographic convention, just show him the output of \underline{Q}=\underline{\underline{A}}\,\underline{w} and ask him for permission to use a different, non-disastrous notation for vectors and matrices. :-) – Mico Apr 17 at 21:33
• @sanach Explaining matrix multiplication in a thesis? That's what every sophomore should know! – egreg Apr 17 at 21:49