7

I'm using the txfonts package in order to access the \lambdaup symbol. In order to maintain consistency with other documents, I'm then loading the lmodern package to reset the font families. However, I would like to keep the style of parentheses for large (> 2 line) matrices (via the \pmatrix environment from amsmath) that \txfonts gives me. Is there a way to do this?

Compare the following example with/without the \usepackage{lmodern} line commented out:

\documentclass{article}
\usepackage{amsmath}
\usepackage{txfonts} % \lambdaup
\usepackage{lmodern}
\begin{document}
    $\begin{pmatrix}
    1 & 0 & 0\\
    0 & 1 & 0\\
    0 & 0 & 1
    \end{pmatrix}$
\end{document}

First image shows the 'default' style of parentheses, from CM fonts:

'Default' style parentheses (CM)

Second image shows the style of parentheses that I am hoping to achieve, from TX fonts:

Desired style of parentheses (TX)

Third image shows egreg's proposed answer:

egreg's answer

5
  • Not sure what you mean with ‘straight’ parentheses, but wouldn't the bmatrix environment yield what you want?
    – Bernard
    Commented Apr 3, 2017 at 9:50
  • Try loading lmodern before txfonts.
    – Bibi
    Commented Apr 3, 2017 at 10:12
  • @Bibi That does keep both \lambdaup and the style of parentheses, but it has the unfortunate side effect of changing the font family for the rest of the text... I need the 'main' font to be CM, to keep it consistent with other documents.
    – JustinT
    Commented Apr 3, 2017 at 10:30
  • Have you looked into using the upgreek package for upright-shaped Greek characters?
    – Mico
    Commented Apr 3, 2017 at 11:37
  • @Mico Unfortunately that gives a different upright \lambda than `\txfonts' - I need the style to be consistent with other documents.
    – JustinT
    Commented Apr 3, 2017 at 11:58

2 Answers 2

4

I think you shouldn't mix the parentheses of TX with those of CM, but here's how you can do.

\documentclass{article}
\usepackage{amsmath}
\usepackage{lmodern}

%\usepackage{txfonts} % \lambdaup
\makeatletter
\let\iftx@libertine\iffalse
\let\iftx@minion\iffalse
\let\iftx@coch\iffalse
\makeatother
\DeclareFontEncoding{LMX}{}{}
\DeclareFontSubstitution{LMX}{ntxexx}{m}{n}
\DeclareSymbolFont{TXlettersA}{U}{ntxmia}{m}{it}
\SetSymbolFont{TXlettersA}{bold}{U}{ntxmia}{b}{it}
\DeclareSymbolFont{TXlargesymbols}{LMX}{ntxexx}{m}{n}
\SetSymbolFont{TXlargesymbols}{bold}{LMX}{ntxexx}{b}{n}

\DeclareMathSymbol{\lambdaup}{\mathord}{TXlettersA}{21}
\DeclareMathDelimiter{(}{\mathopen}{operators}{"28}{TXlargesymbols}{0}
\DeclareMathDelimiter{)}{\mathclose}{operators}{"29}{TXlargesymbols}{1}


\begin{document}

$\begin{pmatrix}
1 & 0 & \lambdaup \\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}$

$(a+b)c$

$\bigl(a+b\bigr)c$

\end{document}

enter image description here

If you prefer the parentheses in the style of txfonts, you can do like this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{lmodern}

%\usepackage{txfonts} % \lambdaup
\DeclareSymbolFont{TXlettersA}{U}{txmia}{m}{it}
\SetSymbolFont{TXlettersA}{bold}{U}{txmia}{bx}{it}
\DeclareSymbolFont{TXlargesymbols}{OMX}{txex}{m}{n}
\SetSymbolFont{TXlargesymbols}{bold}{OMX}{txex}{bx}{n}

\DeclareMathSymbol{\lambdaup}{\mathord}{TXlettersA}{21}
\DeclareMathDelimiter{(}{\mathopen}{operators}{40}{TXlargesymbols}{0}
\DeclareMathDelimiter{)}{\mathclose}{operators}{41}{TXlargesymbols}{1}


\begin{document}

$\begin{pmatrix}
1 & 0 & \lambdaup \\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}$

$(a+b)c$

$\bigl(a+b\bigr)c$

\end{document}

enter image description here

3
  • That's certainly an improvement on what I've managed to do so far, although it doesn't quite do what I want. I may have misunderstood the cause-and-effect of what's going on with the different packages - I'll try and upload an image later to clarify what I'm trying to achieve.
    – JustinT
    Commented Apr 4, 2017 at 10:28
  • @JustinT Added straighter parentheses
    – egreg
    Commented Apr 5, 2017 at 9:35
  • @egreg +1 upvote your answer.
    – Sebastiano
    Commented Apr 5, 2017 at 9:44
1

Instead of loading the deprecated txfonts pacakge, with provides both text and math Times Roman glyphs, you could load the newer newtxmath package, which doesn't modify the text-mode glyphs. Hence, you can keep the Computer Modern text mode font parts.

enter image description here

\documentclass{article}
\usepackage{amsmath}             % for 'pmatrix' env.
\usepackage[cmbraces]{newtxmath} % provides '\lambdaup'
\begin{document}
    $\begin{pmatrix}
    1 & 0 & \lambdaup\\
    0 & 1 & 0\\
    0 & 0 & 1
    \end{pmatrix}$
\end{document}

You must log in to answer this question.

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