10

Is there a way to use kpfonts with fontspec ?

The math font is correctly used but just loading the kpfonts package is not enough for the text. If I add the \setmainfont line (see example) the kp font is used everywhere but bold text is not bold. If I add the \fontencoding line (see example) it is used correctly in the text (including bold) but not for the section titles (either regular kp font or bold computer modern font whether the other line is present or not). I don't really know what this line does (saw it somewhere on the internet).

Here is my minimal (non)working example:

\documentclass[article,a4paper,oneside]{memoir}
\usepackage{kpfonts}
\usepackage{fontspec}

\setmainfont[ExternalLocation]{jkpmn8a.pfb}

\begin{document}
\fontencoding{T1}\fontfamily{jkp}\selectfont

\section{section}
\section{other section}
\subsection{my subsection}

bla bla bla. \textbf{bold}
$v_t : \mathbb{R}^3 \rightarrow \mathbb{R}^3 $

\end{document}
  • 2
    Welcome to TeX.SX! You may have a look on our starter guide. – Corentin May 22 '13 at 18:00
  • Short answer: Not at all! Should be clear after Herbert's answer. Either Kp-Fonts or other Type1 fonts with fontenc or TrueType/OpenType fonts with fontspec. – Speravir May 22 '13 at 18:30
  • Addition: Generally, Truetype fonts could be used with fontenc, but this would need a map file – and this is missing for almost all fonts. – Speravir May 22 '13 at 18:37
8

with XeLaTeX use:

\documentclass[article,a4paper,oneside]{memoir}
\usepackage{fontspec}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}

\begin{document}    
\section{section}
\section{other section}
\subsection{my subsection}

bla bla bla. \textbf{bold}
$v_t : \mathbb{R}^3 \rightarrow \mathbb{R}^3 $

\fontspec{Garamond Premier Pro}
foo bar öäöä

\end{document}

then you'll get the embedded KP fonts:

herbert@shania:~/Dokumente> pdffonts test.pdf
name                          type              encoding         emb sub uni object ID
----------------------------- ----------------- ---------------- --- --- --- ---------
TKCZXS+Kp-Medium              Type 1C           WinAnsi          yes yes no       4  0
DRXZLW+Kp-Regular             Type 1C           WinAnsi          yes yes no       5  0
YKPDIX+Kp--M-Italic           Type 1C           Builtin          yes yes no       6  0
YASURJ+Kp--M-Syb-Regular      Type 1C           Builtin          yes yes no       7  0
DVMGXE+Kp--M-Sy-Regular       Type 1C           Builtin          yes yes no       8  0
QMYVMX+GaramondPremrPro-Identity-H   CID Type 0C Identity-H  yes yes yes 10  0
  • 1
    why do you need fontspec when you want to use Type 1 fonts?? – user2478 May 22 '13 at 18:17
  • 1
    Then use an OpenType font for all which makes more sense. Pagella, for example, is similiar to kpfonts and has math, too – user2478 May 22 '13 at 18:21
  • 1
    I know I can do that and I'll probably end up doing this if nobody has an answer, but I like kpfonts and if there is a solution I would like to know it. – Anne-Laure May 22 '13 at 18:26
  • 1
    see my edited answer – user2478 May 22 '13 at 18:32
  • 2
    Thank you !! I could have sworn I had tried that but I guess I was loading fontenc before fontspec and it didn't work. – Anne-Laure May 22 '13 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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