Rules / Build

Illegal parameter number in definition of \vect — Misused # character

A macro definition uses #n beyond its declared arguments, or a literal # appears in text.

Fix

Declare enough arguments, or write \# for a hash sign.

Example

Reproduced on TeX Live 2026 by CI · pdflatex · corpus/illegal-parameter-number

Macro uses #2 but takes one argument

Fails: main.tex
\documentclass{article}
\newcommand{\vect}[1]{\mathbf{#1}_{#2}}
\begin{document}
Let $\vect{x}$ be the input.
\end{document}
What TeX prints in main.log
! Illegal parameter number in definition of \vect.
<to be read again> 
                   2
l.2 \newcommand{\vect}[1]{\mathbf{#1}_{#2}}
                                           
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.

! You can't use `macro parameter character #' in math mode.
\vect #1->\mathbf {#1}_{##
                          2}
…