# How to redefine \mathbb so that it has the same effect as \mathds?

How I could to redefine \mathbb so that it has the same effect as \mathds? I've been trying to use command line \renewcommand{\mathbb}[1]{\mathds{#1}, but this one has not had any effect.

Here's my preamble!

\documentclass[a4paper,12pt,twoside,openright,final]{memoir}%
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage{soul}
\usepackage{fourier}
\usepackage{import}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage{graphicx}
\usepackage{lastpage}
\usepackage{longtable,rotating}
\usepackage{indentfirst}
\usepackage{colortbl}
\usepackage{wasysym}
\usepackage{mathrsfs}
\usepackage{float}
\usepackage{verbatim}
\usepackage{upgreek}
\usepackage{latexsym}
\usepackage[backend=biber,style=numeric-comp,sorting=none,backref=true,date=year]%
{biblatex}
\usepackage{url}
\usepackage[english,brazilian]{babel}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{bookmark}
\usepackage{memhfixc}
\usepackage{enumerate}
\usepackage{footnote}
\usepackage{microtype}
\usepackage{rotfloat}
\usepackage{alltt}
\usepackage{multicol}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usepackage{lettrine}
\usepackage{geometry}
\usepackage[toc=true,acronym]{glossaries}
\usepackage{dsfont}%
\setcounter{MaxMatrixCols}{30}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{Codepage=65001}
%TCIDATA{LastRevised=Wednesday, February 13, 2019 09:15:52}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="PrintOptions" CONTENT="8256">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Description=Documento tipo livro construido a partir da classe memoir.}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\newsubfloat{figure}
\newsubfloat{table}
\settrimmedsize{297mm}{210mm}{*}
\setlength{\trimtop}{0pt}
\setlength{\trimedge}{\stockwidth}
\settypeblocksize{634pt}{448.13pt}{*}
\setulmargins{4cm}{*}{*}
\setlrmargins{*}{*}{1.5}
\setmarginnotes{17pt}{51pt}{\onelineskip}
\checkandfixthelayout
\geometry{
left=3cm,
right=2cm,
top=3cm,
bottom=2cm
}
\frenchspacing
\setsecnumdepth{subsection}
\maxsecnumdepth{subsubsection}
\input{subdoc/preambulo/new_chapter_style.tex}
\chapterstyle{daleif2modif}
\newcommand{\clearemptydoublepage}{\newpage{\thispagestyle{empty}\cleardoublepage}}
\makeatletter
\hypersetup{
pdftitle={\@title},
pdfauthor={\@author},
citecolor=blue,
filecolor=magenta,
urlcolor=blue,
bookmarksopen=false,
bookmarkstype=toc,
CJKbookmarks=true,
bookmarksdepth=4,
pdfstartview={FitB},
bookmarksnumbered=true
}
\makeatother
\usetikzlibrary{
arrows,
shapes,
automata,
backgrounds,
petri,
topaths
}
\newcommand{\keywords}[1]{\par\noindent{\small{\bfseries Keywords:} #1}}
\newcommand{\palavrachave}[1]{\par\noindent{\small{\bfseries Palavras Chave:} #1}}
\newcommand{\mycaption}[2][\@empty]{
\captionnamefont{\scshape}
\changecaptionwidth
\captionwidth{0.9\linewidth}
\captiondelim{.\:}
\indentcaption{0.75cm}
\captionstyle[\centering]{}
\setlength{\belowcaptionskip}{10pt}
\ifx \@empty#1 \caption{#2}\else \caption[#1]{#2}
}
\newcommand{\mysubcaption}[2][\@empty]{
\subcaptionsize{\small}
\hangsubcaption
\subcaptionlabelfont{\rmfamily}
\sidecapstyle{\raggedright}
\setlength{\belowcaptionskip}{10pt}
\ifx \@empty#1 \subcaption{#2}\else \subcaption[#1]{#2}
}
\newcommand{\initial}[1]{\lettrine[lines=3,lhang=0.33,nindent=0em]{\color{black}{\textsc{#1}}}{}}
\let\mathbb\mathds
\theoremstyle{plain}
\newtheorem{theo}{Theorem}[chapter]
\theoremstyle{plain}
\newtheorem{prop}{Proposition}[chapter]
\theoremstyle{plain}
\theoremstyle{definition}
\newtheorem{dfn}{Definition}[chapter]
\theoremstyle{plain}
\newtheorem{lema}{Lemma}[chapter]
\theoremstyle{plain}
\newtheorem{cor}{Corollary}[chapter]
\theoremstyle{plain}
\newtheorem{resu}{Result}[chapter]
\renewcommand{\baselinestretch}{1.5}
\makeglossaries
\makeindex
\renewcommand{\mathbb}[1]{\mathds{#1}}
\begin{document}

$\mathbb{R}$ and $mathds{R}$

\end{document}

• Why don't you use \mathds{} directly? – user156344 Feb 13 '19 at 13:23
• Where exactly did you place that \renewcommand? – daleif Feb 13 '19 at 13:33
• Well, in the Scientific Workplace (SWP) \mathds{R} it appears as a TexField, whereas \mathbb{R} appears as it will be compiled. If it is possible to redefine \mathbb to \mathds, then I could fool the SWP. – lucenalex Feb 13 '19 at 13:33
• It might have been an idea that you mentioned you are using SWP, then you need to be a lot more careful about where the redefinition or Stevens \let is placed. It has to be placed after amssymb and dsfont is loaded. Hardly anyone here is familiar wit SWP, so that information is very relevant. – daleif Feb 13 '19 at 13:36
• @Alexlucena It is very important to show some more details. You should also try trimming down your example, loading only what still shows the issue. – egreg Feb 13 '19 at 14:06

The fourier package delays its setup to the end of the preamble. So adding \renewcommand\mathbb in the preamble is overwritten by this delayed code.

Try using

\AtBeginDocument{
\renewcommand{\mathbb}[1]{\mathds{#1}}
}


This adds the redefinition to the delay mechanism and (hopefully) executes it after what ever is already added.

BTW: clean up your preamble, are you sure your document needs all this code? It is a good idea to add a comment above each loaded package or piece of code explaining what this does, or why it is loaded. Then it is a lot easier to see what you need and what is actually just legacy stuff you no longer need.

• Worked perfectly! Thank you! I'll clean the code as you suggested! I started with an example of a thesis that I found in the overleaf. I was afraid to go off clearing up the commands lines and so I kept. – lucenalex Feb 13 '19 at 14:17

In this case, \let\mathbb\mathds, though you might want to also \let\svmathbb\mathbb in advance of that, to save a copy.

\documentclass{article}
\usepackage{amsmath,amssymb,dsfont}
\begin{document}
$\mathbb{A} \mathds{A}$

\let\mathbb\mathds
$\mathbb{A} \mathds{A}$
\end{document}


It works without any problem.

\documentclass{article}
\usepackage{amsmath,amssymb,dsfont}

\renewcommand{\mathbb}[1]{\mathds{#1}}

\begin{document}

$\mathbb{X}+\mathbb{Y}$

\end{document}


If you don't load amssymb or amsfonts (or aren't sure whether other packages do), then provide the \mathbb command and then redefine it.

\documentclass{article}
\usepackage{amsmath,dsfont}

\providecommand{\mathbb}{} % ensure \mathbb is defined
\renewcommand{\mathbb}[1]{\mathds{#1}}

\begin{document}

$\mathbb{X}+\mathbb{Y}$

\end{document}


Some math font packages delay the definition of some commands; this is the case of fourier. For this you need to do the redefinition later; the following can also be used without fourier.

\documentclass{article}
\usepackage{amsmath,fourier,dsfont}

\AtBeginDocument{%
\providecommand{\mathbb}{}% ensure \mathbb is defined
\renewcommand{\mathbb}[1]{\mathds{#1}}%
}

\begin{document}

$\mathbb{X}+\mathbb{Y}$

\end{document}

• The OP is using fourier which apparently delays its stuff. – daleif Feb 13 '19 at 13:57