Text FormattingWhy won't this run, (new command -> tcolorbox+theorem)

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
A-M4D53N
Posts: 1
Joined: Sat Jan 13, 2024 11:11 am

Why won't this run, (new command -> tcolorbox+theorem)

Post by A-M4D53N »

\usepackage{tcolorbox}
\usepackage{amsthm,amsmath,amssymb,mathtools}
\newtheorem{theorem}{Theorem}

.
.
.


\newcommand{\nwtherm}[#1]{
\begin{tcolorbox}[colback=yellow!05!white,colframe=yellow!10!black,width=\linewidth,before skip=1mm]
\begin{theorem}
#1
\end{theorem}
\end{tcolorbox}
}


.
.
.

Illegal parameter number in definition of \reserved@a.


‪./preamble.tex, 43‬
<to be read again>
1
l.43 \newcommand{\nwtherm}[#1]
{
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 ##.
Illegal parameter number in definition of \reserved@b.


‪./preamble.tex, 43‬
<to be read again>
1
l.43 \newcommand{\nwtherm}[#1]
{
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 ##.
Missing number, treated as zero.


‪./preamble.tex, 49‬
<to be read again>
##
l.49 }

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
Parameters must be numbered consecutively.


‪./preamble.tex, 49‬
<to be read again>
1
l.49 }

I've inserted the digit you should have used after the #.
Type `1' to delete what you did use.
Parameters must be numbered consecutively.


‪./preamble.tex, 49‬
<to be read again>
2
l.49 }

I've inserted the digit you should have used after the #.
Type `1' to delete what you did use.
Runaway argument?


‪./main.tex, 1‬
##2##3##4##5##6##7##8##9##0##1{ \begin {tcolorbox}[colback=yellow!05!\ETC.
! File ended while scanning use of \reserved@a.
<inserted text>
\par
l.1 \input{preamble}

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
Undefined control sequence.


‪./name.tex, 13‬
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.
Learn more
l.13 \nwtherm
{theorem number 1}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Bartman
Posts: 366
Joined: Fri Jan 03, 2020 2:39 pm

Why won't this run, (new command -> tcolorbox+theorem)

Post by Bartman »

Please create a complete Infominimal working example and mark its code so that it can be tested using the online compiler.

Read in \newcommand and \renewcommand or an introduction to LaTeX (e.g. learnlatex.org) how to specify the number of arguments when defining a command.

By the way, mathtools loads amsmath.
Post Reply