2

I'm using libertine with newtxmath. Actually it is very good but some symbols don't seem good to me as in the figure. enter image description here

Can I use different font from these symbols like given below without changing the other ones? (these are from mathpazo.)

enter image description here

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[lining]{libertine}
\usepackage[libertine,cmintegrals]{newtxmath}
\usepackage{ucs}
\usepackage{amsfonts,amsmath,amssymb}
\usepackage{graphicx}
%------------TIKZ-PGF----------------
\usepackage{tikz,pgf,pgfplots}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{patterns}
%---------------------------------

\begin{document}

\[
f\left(  \mathbf{x}|\theta\right)  =\underset{h\left(  \mathbf{x}\right)
}{\underbrace{1}}\cdot\underset{g_{1}\left(  T\left(  \mathbf{X}_{1}\right)
|\mu\right)  }{\underbrace{\left(  2\pi\sigma^{2}\right)  ^{-n/2}\exp\left[
-\frac{n\left(  \overline{x}-\mu\right)  ^{2}}{2\sigma^{2}}\right]  }%
}\underset{g_{2}\left(  T\left(  \mathbf{X}_{2}\right)  |\sigma\right)
}{\underbrace{\exp\left[  \frac{-1}{2\sigma^{2}}\sum\left(  x_{i}-\overline
{x}\right)  ^{2}\right]  }}%
\]
\[\sqrt{\exp\left[  \frac{-1}{2\sigma^{2}}\sum\left(  x_{i}-\overline
{x}\right)  ^{2}\right]}\]

$\forall\exists= \pm+-$
\end{document}
5
  • Which font(s) do you want them to come from?
    – cfr
    Apr 21, 2014 at 3:31
  • for example computer modern or mathpazo.
    – mert
    Apr 21, 2014 at 6:31
  • 1
    newtxmath provides alternatives for \forall and \exists, namely \forallAlt and \existxAlt
    – Guido
    Apr 21, 2014 at 8:48
  • 2
    @Guido did you mean \existsAlt?
    – cfr
    Apr 21, 2014 at 11:40
  • 2
    @cfr yes I did :-(
    – Guido
    Apr 21, 2014 at 12:17

1 Answer 1

2

Adding the following at the end of your preamble should do the trick:

\DeclareSymbolFont{mysymbols}     {OMS}{cmsy}{m}{n}
\SetSymbolFont{mysymbols}  {bold}{OMS}{cmsy}{b}{n}
\DeclareSymbolFont{myoperators}   {OT1}{cmr} {m}{n}
\SetSymbolFont{myoperators}{bold}{OT1}{cmr} {bx}{n}
\DeclareMathSymbol{\forall}{\mathord}{mysymbols}{"38}
\DeclareMathSymbol{\exists}{\mathord}{mysymbols}{"39}
\DeclareMathSymbol{\pm}{\mathbin}{mysymbols}{"06}
\DeclareMathSymbol{+}{\mathbin}{myoperators}{"2B}
\DeclareMathSymbol{-}{\mathbin}{mysymbols}{"00}
\DeclareMathSymbol{=}{\mathrel}{myoperators}{"3D}

Here's the full MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[lining]{libertine}
\usepackage[libertine,cmintegrals]{newtxmath}
% \usepackage{ucs}% not compatible with utf8 inputenc - see output!
\usepackage{amsfonts,amsmath,amssymb}
\DeclareSymbolFont{mysymbols}     {OMS}{cmsy}{m}{n}
\SetSymbolFont{mysymbols}  {bold}{OMS}{cmsy}{b}{n}
\DeclareSymbolFont{myoperators}   {OT1}{cmr} {m}{n}
\SetSymbolFont{myoperators}{bold}{OT1}{cmr} {bx}{n}
\DeclareMathSymbol{\forall}{\mathord}{mysymbols}{"38}
\DeclareMathSymbol{\exists}{\mathord}{mysymbols}{"39}
\DeclareMathSymbol{\pm}{\mathbin}{mysymbols}{"06}
\DeclareMathSymbol{+}{\mathbin}{myoperators}{"2B}
\DeclareMathSymbol{-}{\mathbin}{mysymbols}{"00}
\DeclareMathSymbol{=}{\mathrel}{myoperators}{"3D}

\begin{document}

\[
f\left(  \mathbf{x}|\theta\right)  =\underset{h\left(  \mathbf{x}\right)
}{\underbrace{1}}\cdot\underset{g_{1}\left(  T\left(  \mathbf{X}_{1}\right)
|\mu\right)  }{\underbrace{\left(  2\pi\sigma^{2}\right)  ^{-n/2}\exp\left[
-\frac{n\left(  \overline{x}-\mu\right)  ^{2}}{2\sigma^{2}}\right]  }%
}\underset{g_{2}\left(  T\left(  \mathbf{X}_{2}\right)  |\sigma\right)
}{\underbrace{\exp\left[  \frac{-1}{2\sigma^{2}}\sum\left(  x_{i}-\overline
{x}\right)  ^{2}\right]  }}%
\]
\[\sqrt{\exp\left[  \frac{-1}{2\sigma^{2}}\sum\left(  x_{i}-\overline
{x}\right)  ^{2}\right]}\]

$\forall \exists \pm = + -$
\end{document}

Note that combining ucs with [utf8]{inputenc} produces warnings in the output. I've commented out ucs here but see the compilation output for other options.

The result:

Adjusted maths

3
  • is it also possible to use "=" symbol from computer modern?
    – mert
    Apr 21, 2014 at 12:35
  • 1
    @mert See my edit. Sorry, I didn't have time to find all the bits I needed to complete this earlier as I had to go out. This code should, I think, meet all the desiderata.
    – cfr
    Apr 21, 2014 at 14:56
  • @mert No problem ;).
    – cfr
    Apr 21, 2014 at 18:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .