2

I am trying to load newtxmath and newtxtext in my work and it is bringing \DeclareRobustCommand{\sustyle}{% error.

I removed amssymb and loaded only newtxmath and newtxtext, it brought \Bbbk is already defined.

I then added \let\Bbbk\relax, it didn't show any effect, it still showed \Bbbk is already defined no matter the position I put \let\Bbbk\relax.

This is my code

\let\Bbbk\relax
\usepackage{newtxtext}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{newtxmath}
\let\openbox\undefined

It is really giving me headache as I have tried every possible combination.

This is my full code

\documentclass[a4paper, 11pt, openany, oneside]{book}
\usepackage{newtxtext}
\usepackage{textcomp}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\let\Bbbk\relax
\usepackage{newtxmath}
\let\openbox\undefined
\usepackage[urlcolor=blue, colorlinks=true, linkcolor=blue, citecolor=red]{hyperref}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{venndiagram}
\usepackage{fancyhdr}
\usepackage{authblk}
\usepackage{phfthm}
\usepackage[inline]{enumitem}
\usepackage{empheq}
\usepackage{multicol}
\usepackage[Glenn]{fncychap}
\usepackage{currency}
\usepackage{tasks}
\usepackage[urlcolor=blue, colorlinks=true, linkcolor=blue, citecolor=red]{hyperref}
\usepackage{longtable}
\usepackage{caption}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\usepackage{tabstackengine}
\usepackage{nicematrix}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\title{Title}
\author{Author}
\theoremstyle{definition}
\newtheorem{ex}{Example}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}
\newcommand{\lra}{\Longrightarrow}
\newcommand{\llra}{\Longleftrightarrow}
\newcommand{\call}{\mathcal}
\newcommand{\inl}{\textup}
\def\contentsname{\textbf{CONTENTS}}
\newcommand{\sbs}{\subset}
\begin{document}

Body

\end{document}

This is the full error code

! LaTeX Error: Command `\Bbbk' already defined.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.261 ...ol{\Bbbk} {\mathord}{AMSb}{"7C}

and

! LaTeX Error: Option clash for package textcomp.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.93 \DeclareRobustCommand {\sustyle}{% ?

3 Answers3

3

Do you really use all those packages?

In this case

\usepackage{phfthm}

is trying to force amsfonts to redefine \Bbbk so genrates an error, commnting out that line makes the issue go.

If you really need the package load it before newtxmath since you want the tx font versions.

David Carlisle
  • 757,742
2

phfthm would seem to be the culprit; it itself loads amsthm and amsmath packages, so you don't need to load those as well; so long as you load it before the newtx* packages, things go OK, at least for me:

No need to undefine \Bbbk or \openbox.

(Edit: Darn it, scooped again!)

\documentclass[a4paper, 11pt, openany, oneside]{book}
\usepackage{phfthm}
\usepackage[T1]{fontenc}
\usepackage{newtxtext,newtxmath}
\usepackage{textcomp}
\usepackage{float}
\usepackage[urlcolor=blue, colorlinks=true, linkcolor=blue, citecolor=red]{hyperref}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{venndiagram}
\usepackage{fancyhdr}
\usepackage{authblk}
\usepackage[inline]{enumitem}
\usepackage{empheq}
\usepackage{multicol}
\usepackage[Glenn]{fncychap}
\usepackage{currency}
\usepackage{tasks}
\usepackage[urlcolor=blue, colorlinks=true, linkcolor=blue, citecolor=red]{hyperref}
\usepackage{longtable}
\usepackage{caption}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\usepackage{tabstackengine}
\usepackage{nicematrix}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\title{Title}
\author{Author}
\theoremstyle{definition}
\newtheorem{ex}{Example}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}
\newcommand{\lra}{\Longrightarrow}
\newcommand{\llra}{\Longleftrightarrow}
\newcommand{\call}{\mathcal}
\newcommand{\inl}{\textup}
\def\contentsname{\textbf{CONTENTS}}
\newcommand{\sbs}{\subset}

\begin{document}

Body $x = y$

\end{document}

frabjous
  • 41,473
2

It's better first to reorder your preamble.

  1. textcomp should no longer be loaded
  2. You probably load float for [H]. Don't.
  3. hyperref should be loaded just once and last.
  4. Once you state \theoremstyle{definition}, it continues to act until countermanded by another \theoremstyle declaration.
  5. \def\contentsname{\textbf{CONTENTS}} is wrong for a couple of reasons: you don't want \textbf to begin with and it should be \renewcommand.

Finally, phfthm should be more cooperative towards other packages, but it seems that loading it before newtxmath solves the issues of duplicate commands. However, you should add the

qedsymbolblacksquare=false

option, because you don't want that amssymb is loaded, as newtxmath provides the symbols by itself. If you really want the black square for the QED symbol, issue

\renewcommand{\qedsymbol}{\ensuremath{\blacksquare}}

in the “settings” section.

\documentclass[a4paper, 11pt, openany, oneside]{book}

\usepackage[qedsymbolblacksquare=false]{phfthm} \usepackage{newtxtext,newtxmath} \usepackage{amsmath} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{patterns} \usepackage{venndiagram} \usepackage{fancyhdr} \usepackage{authblk} \usepackage[inline]{enumitem} \usepackage{empheq} \usepackage{multicol} \usepackage[Glenn]{fncychap} \usepackage{currency} \usepackage{tasks} \usepackage{longtable} \usepackage{caption} \usepackage{tabstackengine} \usepackage{nicematrix}

\usepackage[urlcolor=blue, colorlinks=true, linkcolor=blue, citecolor=red]{hyperref}

\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}

%%% theorems \theoremstyle{definition} \newtheorem{ex}{Example} \newtheorem*{sol}{Solution}

%%% commands \newcommand{\lra}{\Longrightarrow} \newcommand{\llra}{\Longleftrightarrow} \newcommand{\call}{\mathcal} \newcommand{\inl}{\textup} \newcommand{\sbs}{\subset} \makeatletter \newcommand*{\rom}[1]{\expandafter@slowromancap\romannumeral #1@} \makeatother

%%% settings \renewcommand{\contentsname}{CONTENTS} \renewcommand{\qedsymbol}{\ensuremath{\blacksquare}}

%%% metadata \title{Title} \author{Author}

\begin{document}

Body

\begin{proof} OK \end{proof}

\end{document}

enter image description here

egreg
  • 1,121,712