2

I try use boolean expresion which it has been shown on my MNWE:

\documentclass[12pt, b4paper, twoside]{scrbook}   
\usepackage[log-declarations=false]{xparse} 
\usepackage{xltxtra} 
\usepackage{etoolbox}
\usepackage{amsmath, amsthm, amssymb, amsfonts, amsbsy} 

\newbool{pboldvectors}%
\booltrue{pboldvectors}%

\ifbool{pboldvectors}%
  {\renewcommand{\vecc}[1]{\mathbf{#1}}}                      % then clausule
  {\renewcommand{\vecc}[1]{\vec{#1}}}                         % else clausule

\begin{document} 
  \begin{equation}
     \vecc{x}
  \end{equation}
\end{document}

but without success. I have got Latex error: \vecc is undefinned. Before, I used the library ifthen, but it has been obsolete. I would like to use this switch for mathematical formatting.

  • 1
    Simply \vecc has never been defined. So use \newcommand instead of \renewcommand. – karlkoeller Aug 12 '13 at 20:28
  • 2
    @jafan: Please accept karl’s instead, He was the first one an I can’t delete mine as long it is marked as accepted. – Tobi Aug 12 '13 at 20:43
  • 1
    The issue has nothing to do with either koma-script, etoolbox or conditionals. Both tags and title of the question are quite misleading... – clemens Aug 12 '13 at 21:12
  • @cgnieder: I tried to fix it, do you agree with my edit? – Tobi Aug 12 '13 at 21:24
1

To use \renewcomad a command must be defined before. Use \newcommand instead ...

  • This was already in my comment... – karlkoeller Aug 12 '13 at 20:30
  • @karlkoeller: Sorry I over read this (answered from my smart phone …). Why don’t you extend you comment a little an make an answer out of it? I’ll delete mine ;-) – Tobi Aug 12 '13 at 20:32
  • OK, I will now... – karlkoeller Aug 12 '13 at 20:34
4

You can not use \renewcommand when a command has never been defined before, as in the case of \vecc.

In these cases you have to use \newcommand instead of \renewcommand.

So the code

\documentclass[12pt, b4paper, twoside]{scrbook}   
\usepackage[log-declarations=false]{xparse} 
\usepackage{xltxtra} 
\usepackage{etoolbox}
\usepackage{amsmath, amsthm, amssymb, amsfonts, amsbsy} 

\newbool{pboldvectors}%
\booltrue{pboldvectors}%

\ifbool{pboldvectors}%
  {\newcommand{\vecc}[1]{\mathbf{#1}}}                      % then clausule
  {\newcommand{\vecc}[1]{\vec{#1}}}                         % else clausule

\begin{document} 
  \begin{equation}
     \vecc{x}
  \end{equation}
\end{document}

will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.