Weight Matrix in LaTeX (\mathbf{W})
- LaTeX command
\mathbf{W}- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Bold upright W, the conventional notation for a weight matrix in a neural network layer.
Bold capitals denote matrices and bold lowercase letters denote vectors, so a dense layer is \mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b}, with layer-specific weights written \mathbf{W}^{(l)} or \mathbf{W}_l. \mathbf produces upright bold Latin letters; it does not bold Greek letters or most symbols, so use \boldsymbol or \bm for \boldsymbol{\Sigma} or a bold \theta. Many deep learning papers drop the bold entirely and write W; choose one convention and keep it throughout. The transpose is usually \mathbf{W}^\top, which reads more cleanly than ^T.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Weight Matrix: $\mathbf{W}$
\[ \mathbf{h}_{l+1} = \sigma(\mathbf{W}_l \mathbf{h}_l + \mathbf{b}_l) \]
\end{document}Related symbols
All Machine Learning & AI →Frequently asked questions
- How do I write Weight Matrix in LaTeX?
- Type \mathbf{W} in math mode, for example $\mathbf{h}_{l+1} = \sigma(\mathbf{W}_l \mathbf{h}_l + \mathbf{b}_l)$. It works in plain LaTeX without loading any package.
- Which package do I need for \mathbf{W}?
- None. \mathbf{W} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \mathbf{W} in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\mathbf{W}$ in running text.
Beste AI LaTeX Editor, Overleaf Alternatief
Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI
- Genereer mooie TikZ-diagrammen met AI
- Upload afbeelding en converteer naadloos naar LaTeX
- Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen