Consider this .tex file
\documentclass[10pt]{article}
\usepackage{MWE}
\MWESettings[X=8]{article}
\begin{document}
The answer is \name
\end{document}
Where MWE.sty is
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{MWE}
\RequirePackage{xstring}
\RequirePackage{keycommand}
\newkeycommand{\MWESettings}[X=1][1]
{
\IfEq{#1}{article} { \newcommand{\name}{article \commandkey{X}} } <-- Line A
\IfEq{#1}{news} { \newcommand{\name}{news \commandKey{X}} } <-- Line B
}
If I pdflatex the .tex file I get this error:
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.4 \begin{d
ocument}
What am I doing wrong?
\MWEsettings[X=8]{article}essentially does\newcommand{\name}{article 8}? – egreg Jan 30 '17 at 21:29\MWESettingscommand before\begin{document}this way – Jan 30 '17 at 21:38