Why Isn't \mathbb Working in My Latex Document?

  • Context: LaTeX 
  • Thread starter Thread starter Zurtex
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion revolves around issues related to using the \mathbb command in LaTeX documents, specifically within the context of writing mathematical expressions. Participants share their experiences and suggestions regarding LaTeX packages and alternatives for typesetting mathematics.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant mentions having trouble with the \mathbb command and suggests they can use \mathrm and \mathbf as alternatives, but these do not meet their needs.
  • Another participant advises ensuring the inclusion of the \usepackage{amssymb} in the preamble to enable the use of \mathbb.
  • A suggestion is made to use Open Office Maths as a simpler alternative, although one participant notes its limitations for full papers.
  • MathType is recommended by another participant as an easy-to-learn tool that can convert to LaTeX and is compatible with Microsoft Word.
  • A participant shares an old .sty file and template that worked for them with MikTeX, but notes that not all environments in the style file function correctly.

Areas of Agreement / Disagreement

Participants express various suggestions and tools for typesetting mathematics, but there is no consensus on a single solution or approach. The discussion remains unresolved regarding the best method to address the original issue with \mathbb.

Contextual Notes

Some participants mention specific packages and tools that may not be universally applicable, and there are references to personal experiences that may not reflect broader usability.

Zurtex
Science Advisor
Homework Helper
Messages
1,118
Reaction score
1
Hey

I'm wanting to write up a small paper so I've installed various Latex things on my computer, I have the full Miktex package and I have TexnicCenter, I want to write something like:

\text{For all x, y} \, \in \mathbb{N}

But the mathbb bit doesn't seem to be working, I can get mathrm and mathbf, but these aren't the fonts I want, can anyone help me please.
 
Physics news on Phys.org
make sure you've got

\usepackage{amssymb}

in the preamble, and plenty of other pckages.

google to find out which package provides mathbb ot make sure I've got it right.
 
You could use Open Office Maths. Its quick, easy and free. http://www.openoffice.org/"
 
Last edited by a moderator:
Focus said:
You could use Open Office Maths. Its quick, easy and free. http://www.openoffice.org/"
But quite painful to do full maths papers, I've found it useful to do maths homework but anything like papers or coursework it just doesn't have the functionality for.

Plus it doesn't actually have all the symbols I require most the time and I end up depending on Mathematica fonts.

Anyway thanks matt, I think I've about worked it out but I spotted a mistake in my proof so I've been trying quite desperately to patch it up.
 
Last edited by a moderator:
Hey Zurtex, you can try http://www.dessci.com/en/products/mathtype/
MathType is quiet easy to learn and
has several advanced functions.

Mathtype can convert to \LaTeX, MathML,...or you can just inline your equations as simple images. It is compatible with Microsoft Word, and you can later distill your documents into PDF files.
 
As a bit of inspiration, here are an old .sty file and a template i used some time ago. place both files quoted below in the same directory and compile. works fine with my MikTeX (do note that not all enviroments in the style file work!, but the template compiles fine).


First here is "projects.sty":
Code:
%------------------------------------------------------------------------------
% Contents: Commands, package loading and page settings
% Id: projects.sty
%------------------------------------------------------------------------------
% By Bo Lind
%------------------------------------------------------------------------------
\ProvidesPackage{projects}

%--------------------------------------------------------
% Page setup and page style
%--------------------------------------------------------
\setlrmarginsandblock{1.5in}{0.8in}{*} % Sets the inner and outer margins
\setulmarginsandblock{1in}{1.3in}{*} % Sets the top and bottom margins
%\setmarginnotes{0.2in}{1.7in}{0.3in}

\checkandfixthelayout

\setlength{\droptitle}{3cm} % Sets the length before the title
\aliaspagestyle{title}{empty} % no page number on the front page

\newcommand{\published}[1]{
  \gdef\puB{#1}
}
\newcommand{\puB}{}
\renewcommand{\maketitlehookd}{
  \vskip 30em
  \begin{center}
    \puB
  \end{center}
}
\newcommand{\subtitle}[1]{
  \gdef\suB{#1}
}
\newcommand{\suB}{}
\renewcommand{\maketitlehookb}{
  \begin{center}
    \LARGE\scshape\suB
  \end{center}
}

\pretitle{\begin{center}\Huge\bfseries}
\posttitle{\par\end{center}\vskip 0.5em}
\preauthor{\begin{center}
    \large\bfseries \vskip 8em%
    \begin{tabular}[t]{c}}
\postauthor{\end{tabular}\end{center}}
\predate{\begin{center}\large}
\postdate{\par\end{center}}

\cftsetindents{chapter}{1.5em}{6.0em}
%\cftsetindents{subsection}{5.5em}{6.0em}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterpresnum}{\chaptername\ }

\maxsecnumdepth{subsection}
\setsecnumdepth{subsection}
\maxtocdepth{subsection}

\captiondelim{. }
\captionnamefont{\small\scshape}
\captiontitlefont{\small}

%\tightlists % suppress space between list entries

\pagestyle{plain}
\renewcommand{\baselinestretch}{1.1} % 1.1 line-distance

\usepackage[danish]{varioref} % More inteligent refrences.
\usepackage[round]{natbib} % Use author-date citation.

%--------------------------------------------------------
% Fonts and layout
%--------------------------------------------------------

\usepackage[latin1]{inputenc} % Input encoding. Makes it possible to type special characters.
\usepackage[danish]{babel} % Danish hyphenation and changes Figures, Chapter etc to Danish.
\usepackage{lmodern} % Makes the Latin Modern fonts the default for LaTeX.
\usepackage[T1]{fontenc} % Standard font encoding.
\usepackage{textcomp} % TS1-encoding symbols.

\usepackage{amssymb}
\usepackage{amsfonts} % Better math fonts.
\usepackage{amsmath} % Provides various features to facilitate writing math formulas and to improve the typographical quality of their output. 

\usepackage{bm} % Blackboard Bold font.

\usepackage{url} 
\usepackage{units} % To typeset units use the command \unit{m^2}.

%--------------------------------------------------------
% Enviroments, theorems etc.
%--------------------------------------------------------

\usepackage[amsmath,thmmarks]{ntheorem}


\theoremstyle{plain}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\itshape}
\newtheorem{thm}{Sætning}[chapter]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{kor}[thm]{Korollar}
\newtheorem{eks}[thm]{Eksempel}

\theorembodyfont{\normalfont}
\newtheorem{defn}[thm]{Definition}
\newtheorem{exerc}{\O{}velse}[chapter]

\theoremstyle{nonumberplain}
\theoremheaderfont{\normalsize\normalfont\scshape}
\theorembodyfont{\upshape}
\theoremsymbol{\rule{1ex}{1ex}}
\newtheorem{proof}{Bevis}

\newcommand{\refthm}[1]{S\ae{}tning~\ref{#1}}
\newcommand{\reflemma}[1]{Lemma~\ref{#1}}
\newcommand{\refcor}[1]{Korollar~\ref{#1}}
\newcommand{\refdefn}[1]{Definition~\ref{#1}}
\newcommand{\refexerc}[1]{\O{}velse~\ref{#1}}
\newcommand{\refexample}[1]{Eksempel~\ref{#1}}

%--------------------------------------------------------
% Useful commands
%------------------------------------------------------------------------- Misc

\newcommand{\itemMath}[1]{\raisebox{-\abovedisplayshortskip}{%
 \parbox{0.75\linewidth}{%
 \[#1\]}}}


%---------------------------------------------------------- Figure preferences:
% The following four numbers are to make TeX more likely to put figures on the
% same page rather than on a separate figures page. Can tinker with these, but
% make sure floatpagefraction<topfraction.
% Values recommended by the web page I found were 0.15, 0.85, 0.65, 0.60. The 
% default values are 0.2, 0.7, 0.3, 0.5
%\renewcommand{\textfraction}{0.2}
%\renewcommand{\topfraction}{0.7}
%\renewcommand{\bottomfraction}{0.3}
%\renewcommand{\floatpagefraction}{0.5}
%---------------------------------------------------------------------- Figures
\newcommand\tabcaption{\def\@captype{table}\caption}
\newcommand\figcaption{\def\@captype{figure}\caption}

\usepackage[dvips]{graphicx}
\usepackage{sidecap}
\usepackage{psfrag}

\newlength{\marginwidth} % Let a length to use for margin figures
\setlength{\marginwidth}{\marginparwidth} 
\addtolength{\marginwidth}{\marginparsep}

% \begin{adjustwidth*}{0in}{-\marginwidth} ... \end{adjustwidth*} needs to be 
% placed OUTSIDE the table environment to work, while it can be placed INSIDE 
% in the figure enviroment. (In memoir).

\newcommand{\fig}[3]{ %\fig{filename}{caption}{optional commands}
  \begin{figure}[htbp]
    #3
    \center
    \includegraphics{#1}
    \figcaption{#2} %
    \label{fig:#1} %
  \end{figure}
}

\newcommand{\sidefig}[3]{ %\sigfig{filename}{caption}{optional commands}
  \begin{SCfigure}[][htbp]
    #3
    \includegraphics[width=0.5\textwidth]{#1}
    \caption{#2} %
    \label{fig:#1} %
  \end{SCfigure}
}

%---------------------------------------------------------------------- Physics

\newcommand{\Hamiltonian}{\mathcal{H}}
\newcommand{\Lagrangian}{\mathcal{L}}
\newcommand{\mean}[1]{\langle #1 \rangle}

%------------------------------------------------------------------------- Sets
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}

\newcommand{\emtyset}{\varnothing}

\newcommand{\set}[1]{\ensuremath{\{#1\}}} 
\newcommand{\suchthat}{\bigm|}
\newcommand{\union}{\cup}
\newcommand{\Union}{\bigcup}
\newcommand{\intersection}{\cap}
\newcommand{\Intersection}{\bigcap}

% Other set commands:
% \complement
% \setminus
% \in

\newcommand{\map}[3]{\ensuremath{#1\colon #2\to #3}}

%---------------------------------------------------------------------- Vectors
\renewcommand{\vec}[1]{\bm{\mathrm{#1}}}
\newcommand{\uvec}[1]{\vec{e}_{#1}}

\newcommand{\ket}[1]{\, |#1\rangle}
\newcommand{\bra}[1]{\langle #1 |\,} 

\newcommand{\rr}{\vec{r}}
\newcommand{\vv}{\vec{v}}
\newcommand{\aaa}{\vec{a}}

\newcommand{\zero}{\ensuremath{\mathbf{0}}}

%------------------------------------------------------------------ Derivatives
\newcommand{\D}[2]{\frac{d #1}{d #2}}
\newcommand{\DD}[2]{\frac{d^2 #1}{d #2^2}}
\newcommand{\PD}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\PDD}[2]{\frac{\partial^2 #1}{\partial #2^2}}

%-------------------------------------------------------------------- Integrals
\newcommand{\oiint}{\int\hspace{-2ex}\int\hspace{-3.04ex}\bigcirc~}
\renewcommand{\iint}{\int\hspace{-1.5ex}\int}
\renewcommand{\iiint}{\int\hspace{-1.5ex}\int\hspace{-1.5ex}\int}

here is template.tex
Code:
\documentclass[a4paper,10pt,twoside,article]{memoir}

\usepackage{projects}

\title{Title of the project}
\subtitle{Subtitle}
\author{xxxxx xxxxxx \textnormal{, \textsc{cpr no. xxxxxx}}}
\date{\today}
\published{Fysisk Institut, Syddansk Universitet}
%\published{Physics Department\\ University of Southern Denmark}

%--------------------------------------------------------------\begin{document}
\begin{document}
\frontmatter

\maketitle
\newpage

%\tableofcontents*
%\listoffigures*
%\listoftables*
%\newpage

%\begin{abstract}
%  Max en side der sammenfatter, hvad rapporten handler om og hvilke konklusioner, der drages i rapporten
%\end{abstract}
%\newpage

\mainmatter
%------------------------------------------------------------chapter:Indledning
\chapter{Indledning}\label{cha:indledning}

\[
\forall x,y\in\N
\]

\appendix


\bibliography{mybiblio}
\bibliographystyle{plainnat} 

%In \cite{qriffiths:quantum} ... 

\end{document}
 
bomba923 said:
Hey Zurtex, you can try http://www.dessci.com/en/products/mathtype/
MathType is quiet easy to learn and
has several advanced functions.

Mathtype can convert to \LaTeX, MathML,...or you can just inline your equations as simple images. It is compatible with Microsoft Word, and you can later distill your documents into PDF files.
Same problem with Mathtype as I have with open office, just doesn't work for writting lots of stuff. Mathtype is even worse really because of its wysiwyg interface.

Thanks Triss, I'll try it out :smile:
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 36 ·
2
Replies
36
Views
2K
  • · Replies 7 ·
Replies
7
Views
12K
  • · Replies 2 ·
Replies
2
Views
2K