Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I don't want to use txfonts package because the Body will be affected. I just want to declare the correct font that being use by \varmathbb tag/code but I did not fount it.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{txfonts}
\usepackage{dsfont}
\usepackage{lipsum}
%\DeclareSymbolFont{letters}{OT1}{cmr}{m}{n}
%\DeclareSymbolFontAlphabet{\varmathbb}{letters}

\begin{document}

\lipsum[1]
$\mathds{R}$


$\mathbb{R}$


$\varmathbb{R}$ -output should look this by not using the txfonts package.

\end{document}
share|improve this question
    
What do you mean by “correct”? I usually use \usepackage{dsfont} and \mathds{A} for a different double-struck font. –  canaaerus Sep 6 '12 at 6:10
    
Try to check the new code I presented. –  jeecabz Sep 6 '12 at 7:06
add comment

2 Answers 2

up vote 3 down vote accepted

Just to complement Heiko's answer, here's a simpler implementation with xparse and expl3:

\documentclass{article}
\usepackage{xparse}

\DeclareSymbolFont{lettersA}{U}{txmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{txmia}{bx}{it}
\DeclareFontSubstitution{U}{txmia}{m}{it}

\makeatletter
\DeclareMathSymbol{\m@thbbch@rA}{\mathord}{lettersA}{129}
\DeclareMathSymbol{\m@thbbch@rB}{\mathord}{lettersA}{130}
\DeclareMathSymbol{\m@thbbch@rC}{\mathord}{lettersA}{131}
\DeclareMathSymbol{\m@thbbch@rD}{\mathord}{lettersA}{132}
\DeclareMathSymbol{\m@thbbch@rE}{\mathord}{lettersA}{133}
\DeclareMathSymbol{\m@thbbch@rF}{\mathord}{lettersA}{134}
\DeclareMathSymbol{\m@thbbch@rG}{\mathord}{lettersA}{135}
\DeclareMathSymbol{\m@thbbch@rH}{\mathord}{lettersA}{136}
\DeclareMathSymbol{\m@thbbch@rI}{\mathord}{lettersA}{137}
\DeclareMathSymbol{\m@thbbch@rJ}{\mathord}{lettersA}{138}
\DeclareMathSymbol{\m@thbbch@rK}{\mathord}{lettersA}{139}
\DeclareMathSymbol{\m@thbbch@rL}{\mathord}{lettersA}{140}
\DeclareMathSymbol{\m@thbbch@rM}{\mathord}{lettersA}{141}
\DeclareMathSymbol{\m@thbbch@rN}{\mathord}{lettersA}{142}
\DeclareMathSymbol{\m@thbbch@rO}{\mathord}{lettersA}{143}
\DeclareMathSymbol{\m@thbbch@rP}{\mathord}{lettersA}{144}
\DeclareMathSymbol{\m@thbbch@rQ}{\mathord}{lettersA}{145}
\DeclareMathSymbol{\m@thbbch@rR}{\mathord}{lettersA}{146}
\DeclareMathSymbol{\m@thbbch@rS}{\mathord}{lettersA}{147}
\DeclareMathSymbol{\m@thbbch@rT}{\mathord}{lettersA}{148}
\DeclareMathSymbol{\m@thbbch@rU}{\mathord}{lettersA}{149}
\DeclareMathSymbol{\m@thbbch@rV}{\mathord}{lettersA}{150}
\DeclareMathSymbol{\m@thbbch@rW}{\mathord}{lettersA}{151}
\DeclareMathSymbol{\m@thbbch@rX}{\mathord}{lettersA}{152}
\DeclareMathSymbol{\m@thbbch@rY}{\mathord}{lettersA}{153}
\DeclareMathSymbol{\m@thbbch@rZ}{\mathord}{lettersA}{154}
\makeatother

\ExplSyntaxOn
\NewDocumentCommand{\varmathbb}{m}
 {
  \tl_map_inline:nn { #1 } { \use:c { m@thbbch@r##1 } }
 }
\ExplSyntaxOff

\begin{document}
$\varmathbb{ABC}$
\end{document}
share|improve this answer
add comment

The relevant code for \varmathbb of package txfonts:

\makeatletter
\DeclareSymbolFont{lettersA}{U}{txmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{txmia}{bx}{it}
\DeclareFontSubstitution{U}{txmia}{m}{it}

\DeclareMathSymbol{\m@thbbch@rA}{\mathord}{lettersA}{129}
\DeclareMathSymbol{\m@thbbch@rB}{\mathord}{lettersA}{130}
\DeclareMathSymbol{\m@thbbch@rC}{\mathord}{lettersA}{131}
\DeclareMathSymbol{\m@thbbch@rD}{\mathord}{lettersA}{132}
\DeclareMathSymbol{\m@thbbch@rE}{\mathord}{lettersA}{133}
\DeclareMathSymbol{\m@thbbch@rF}{\mathord}{lettersA}{134}
\DeclareMathSymbol{\m@thbbch@rG}{\mathord}{lettersA}{135}
\DeclareMathSymbol{\m@thbbch@rH}{\mathord}{lettersA}{136}
\DeclareMathSymbol{\m@thbbch@rI}{\mathord}{lettersA}{137}
\DeclareMathSymbol{\m@thbbch@rJ}{\mathord}{lettersA}{138}
\DeclareMathSymbol{\m@thbbch@rK}{\mathord}{lettersA}{139}
\DeclareMathSymbol{\m@thbbch@rL}{\mathord}{lettersA}{140}
\DeclareMathSymbol{\m@thbbch@rM}{\mathord}{lettersA}{141}
\DeclareMathSymbol{\m@thbbch@rN}{\mathord}{lettersA}{142}
\DeclareMathSymbol{\m@thbbch@rO}{\mathord}{lettersA}{143}
\DeclareMathSymbol{\m@thbbch@rP}{\mathord}{lettersA}{144}
\DeclareMathSymbol{\m@thbbch@rQ}{\mathord}{lettersA}{145}
\DeclareMathSymbol{\m@thbbch@rR}{\mathord}{lettersA}{146}
\DeclareMathSymbol{\m@thbbch@rS}{\mathord}{lettersA}{147}
\DeclareMathSymbol{\m@thbbch@rT}{\mathord}{lettersA}{148}
\DeclareMathSymbol{\m@thbbch@rU}{\mathord}{lettersA}{149}
\DeclareMathSymbol{\m@thbbch@rV}{\mathord}{lettersA}{150}
\DeclareMathSymbol{\m@thbbch@rW}{\mathord}{lettersA}{151}
\DeclareMathSymbol{\m@thbbch@rX}{\mathord}{lettersA}{152}
\DeclareMathSymbol{\m@thbbch@rY}{\mathord}{lettersA}{153}
\DeclareMathSymbol{\m@thbbch@rZ}{\mathord}{lettersA}{154}

\long\def\DoLongFutureLet #1#2#3#4{%
   \def\@FutureLetDecide{#1#2\@FutureLetToken
      \def\@FutureLetNext{#3}\else
      \def\@FutureLetNext{#4}\fi\@FutureLetNext}
   \futurelet\@FutureLetToken\@FutureLetDecide}
\def\DoFutureLet #1#2#3#4{\DoLongFutureLet{#1}{#2}{#3}{#4}}
\def\@EachCharacter{\DoFutureLet{\ifx}{\@EndEachCharacter}%
   {\@EachCharacterDone}{\@PickUpTheCharacter}}
\def\m@keCharacter#1{\csname\F@ntPrefix#1\endcsname}
\def\@PickUpTheCharacter#1{\m@keCharacter{#1}\@EachCharacter}
\def\@EachCharacterDone \@EndEachCharacter{}

\DeclareRobustCommand*{\varmathbb}[1]{\gdef\F@ntPrefix{m@thbbch@r}%
  \@EachCharacter #1\@EndEachCharacter}
\makeatother
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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