It seems that Latin Modern Math font works fine only with XeTeX and LuaTeX. Is it possible to use Latin Modern Math font with LaTeX and pdfLaTeX?

The publisher requires that I use LaTeX/pdfLaTeX, so using XeTeX or LuaTeX is not an option. I cannot use strange packages, I have to use minimal additional packages. The article's font is Latin Modern and the encoding of the file is set to uft8 and I am not permitted to change these.

I want to use the \lBrack symbol in Latin Modern Math font. The font is defined according to Unicode Math Symbols in Latin Modern Math. However, when I use \lBrack pdfLaTeX tells me that \lBrack is not defined. The issue is not the command \lBrack itself. I don't mind defining it. I just want to have the symbol for \lBrack (Unicode 027E6) from the Latin Modern Math font appear in my output, i.e. the PDF file generated by pdfLaTeX.

I don't want to use other packages that provide similar symbols, it is not an option.

If I were using XeLaTeX I could have written something like:






But as I wrote I am not allowed to use XeLaTeX and have to use pdfLaTeX. If I run pdfLaTeX on the same code I get an error because unicode-math requires XeLaTeX or LuaTex engine.

Essentially, I want to has some command without add anymore packages which does what the code above does in XeLaTeX.

I have tried to directly access the charter but it doesn't seem to work. For example, I tried:







This does compile with pdfLaTeX but it doesn't work correctly: it produces another character, not \lBrack.

ps: I don't have a clue why I need to put \mathsf{\mathbf{}} there, neither I understand why I need the amssymb package, but without these it doesn't compile. It gives an error

\textfont 7 is undefined (character è)
  • What are you doing now if they are not working with latex/pdflatex? Are you using \usepackage{lmodern} in your preamble? – Werner Jul 8 '13 at 1:40
  • @Werner, yes, I have it. I want to use \lBrack but pdfLaTeX says it is not defined. – Kaveh Jul 8 '13 at 1:45
  • You need to use the nath package. – A.Ellett Jul 8 '13 at 2:24
  • @A.Ellett, I don't see how it is related. If I just wanted the symbol I could just use stmaryrd. – Kaveh Jul 8 '13 at 2:36
  • 1
    I'm not really sure what you're saying. Based on your response to @Werner you seem to say \lBrack is not defined, but you need to load a package which provides that command: I was suggesting nath. Maybe you should post a MWE so we can better understand what's not working for you. – A.Ellett Jul 8 '13 at 2:40

First a side remark: With xelatex you should never load inputenc (you did it in your example).

Beside this: Theoretically it is possible to use symbols from an open type font in pdftex. But you need to create a tfm-file, you need to create enc-file(s) and a map-entry. And as pdftex can't subset open type you probably also need to split the open type and create various type1 fonts. This means a lot of work - and imho all this new files will count as "strange packages" and so your publisher will not like it. If you really don't want to use any other package you could perhaps cheat like this:

$\lbrack\!\lbrack x \rbrack\!\rbrack$
  • I see. So there is no easy way (in particular, with these extra files that I would need to send to the publisher) to output the \lBrack symbol from lmodern directly. – Kaveh Jul 8 '13 at 8:08

Here a solution (and solution sketch) for a fixed font size (10pt in the example):

  1. A LuaTeX document prints the one character on a page with known margins around the character box. The example uses 10bp. As unit bp is used, because it is the natural unit for PostScript and PDF. That makes calculations easier.

    % lbrack.tex
    \mag=10000 % enlarge by factor 10
    % print the TeX dimensions of the character glyph
    \typeout{* wd = \the\wd0}
    \typeout{* ht = \the\ht0}
    \typeout{* dp = \the\dp0}
    % the rule in the margin marks the base line
    \sbox0{\vrule width 10bp height .1bp depth .1bp $\lBrack$}
    % add margin of 10bp to the other margins
    % Output the box on a PDF page with the same dimensions.

    The command to generate the PDF file:

    $ lualatex lbrack
  2. Then ghostscript's pswrite device writes the PostScript description of the character glyph in a PostScript file. However, the size must be large enough, otherwise pswrite uses an bitmap inline graphics. Therefore I have used \mag=10000 in the TeX document in the step before. This enlarges the character by a factor 10.

    The command to generate the PostScript file:

    $ gs -sDEVICE=pswrite -sOutputFile=lbrack.ps -dBATCH -dNOPAUSE lbrack.pdf

    The page description of lbrack.ps:

    %%Page: 1 1
    %%PageBoundingBox: 0 0 241 300
    GS_pswrite_2_0_1001 begin
    241 300 null setpagesize
    /pagesave save store 197 dict begin
    0.1 0.1 scale
    gsave mark
    Q q
    0 0 2414 0 0 2996 ^ Y
    20 w
    0 1249.1 1000 0 S
    0.996264 i
    1386.55 1020 m
    0 11 -8.98 20 -19.93 20 c
    -84.62 0 0 916 ^ p
    10.95 0 19.93 9 19.93 20 c
    0 11 -8.99 20 -19.97 20 c
    -249.61 0 0 -996.02 ^ p
    10.98 0 19.97 9 19.97 20 c
    1242 1956 0 -916 -85.03 0 ^ H
    cleartomark end end pagesave restore
  3. This description can be transferred to PDF page description operators. However the short operators above (m, ^, p, c, ...) are user defined operators that are defined in the preamble. For example, m expands to moveto and c to rcurveto. For moveto there is a direct PDF operator m, but the PDF operator for cubic Bézier curves is c that means curveto in PostScript. Thus the relative coordinates of rcurveto needs to be converted to absolute coordinates for curveto. Example, some recalculations are shown in the comments:

    0.996264 i
    1386.55 1020 m
    % 0 11 -8.98 20 -19.93 20 c
    1386.55 1031 1377.57 1040 1366.62 1040 curveto
    % -84.62 0 0 916 ^ pstack p
    % -84.62 0 rlineto 0 916 rlineto 84.62 0 rlineto
    1282 1040 lineto 1282 1956 lineto 1366.62 1956 lineto
    % current point: 1366.62 1956
    % 10.95 0 19.93 9 19.93 20 c
    1377.57 1956 1386.55 1965 1386.55 1976 curveto
    % current point: 1386.55 1976
    % 0 11 -8.99 20 -19.97 20 c
    1386.55 1987 1387.56 1996 1366.58 1996 curveto
    % -249.61 0 0 -996.02 ^ p
    % -249.61 0 rlineto 0 -996.02 rlineto 249.61 0 rlineto
    1116.97 1996 lineto 1116.97 999.98 lineto 1366.58 999.98 lineto
    currentpoint pstack pop pop
    % current point: 1366.58 999.98
    % 10.98 0 19.97 9 19.97 20 c
    1377.56 999.98 1386.55 1008.95 1386.55 1019.98 curveto
    % 1242 1956 0 -916 -85.03 0 ^ H
    % 1242 1956 moveto 0 -916 rlineto -85.03 0 rlineto 0 916 rlineto
    1242 1956 moveto 1242 1040 lineto 1156.97 1040 lineto 1156.97 1956 line

    Also the PostScript coordinates are scaled with factor 10 by pswrite (see 0.1 0.1 scale in the page setup section) and we had scaled it by factor 10 via \mag=10000. Thus the absolute coordinates needs a correction of 1000 at the left and bottom side. The result in PDF page operations can be seen in the TeX file in the next step.

  4. The TeX file puts the PDF page operations in \pdfliteral in a \hbox. The console output or the .log file of step 1 tells us the dimensions of the box. The shift for the baseline that is used for the cm operator can be seen from the vertical coordinate of the \vrule in the PostScript output.

    Then the box is put into a PDF XForm Object. Thus the PDF page operations are stored in one place only and just the XForm Object is reused (optimization, if the glyph is used several times).

    Finally, \lBrack and \rBrack are defined (if they are unknown). Because of laziness \rBrack is just the mirrored version of \lBrack. IMHO that should be close enough.

    % test.tex
      \setbox0=\hbox to 4.16pt{%
          q % save   
          #2.01 0 0 .01 0 -2.491 cm % set current transfer matrix
          .996264 i % flatness tolerance
          386.55 20 m % moveto
          386.55 31 377.57 40 366.62 40 c % curveto
          282 40 l % lineto
          282 956 l % lineto
          366.62 956 l % lineto
          377.57 956 386.55 965 386.55 976 c % curveto
          386.55 987 387.56 996 366.58 996 c % curveto
          116.97 996 l % lineto
          116.97 -.02 l % lineto
          366.58 -.02 l % lineto
          377.56 -.02 386.55 8.95 386.55 19.98 c % curveto
          h % closepath
          242 956 m % moveto
          242 40 l % lineto 
          156.97 040 l % lineto
          156.97 956 l % lineto
          f % fill
          Q% restore 
      \ht0=7.5pt %
      \dp0=2.5pt %
      \pdfxform0 %
      \[ \lBrack x \rBrack \]

    This file can now be compiled with pdflatex:

    $ pdflatex test
  5. For different math styles (\scriptstyle, \scriptscript style), the procedure needs to be repeated. The symbol can then be defined via \mathchoice. However, \left and \right are not supported.



  • Thanks. However, I don't want to embed the symbol in my source file, I want to use the symbol from the font. Part of the reason I want to use Latin Modern Math font is that it behaves nicely e.g. regarding scale, etc. – Kaveh Jul 8 '13 at 19:46
  • 2
    @Kaveh: That does not help either, you need more or less to generate a Type 1 variant and then your publisher will miss the font. If the publisher do not need to recompile the file he would be happy with PDF and then you can use LuaLaTeX or XeLaTeX. – Heiko Oberdiek Jul 8 '13 at 19:58
  • If I could just send them the pdf I would send them the one I got from XeLaTeX. They want the LaTeX file, our article is just one of the articles in the issue. From what you and Ulrike wrote it seems that there is no easy way of employing the symbol from the font directly. So I decided to use the cheat that Ulrike suggested for now, it is not perfect but I seems OK. It is sad that we have such a nice font and we can't use all of it in LaTeX. – Kaveh Jul 8 '13 at 20:15

Maybe I better understand what you're talking about. So, I'll give it yet another stab.

You talk about symbol 027E6 which is a unicode font character. You can gain access to this character through the package unicode-math. But then you'll have to use some flavor of LaTeX other than pdfLaTeX: for example, according to the package, xetex or luatex.

Otherwise you're going to have to do a bit of hacking. If, for example, you're directly entering unicode characters into your document, then you'll have to do some kind of work around as follows:


which is basically telling pdfLaTeX that you're using a different encoding for your characters/glyphs in your source file, and that when it sees unicode character 027E6 it should treat this glyph as though it were the command \llbracket provided by stmaryrd.

At this point I'm assuming you're working with a MWE along the following lines:






where I've directly entered the unicode character in question.

I should point out that this really has nothing to do with Latin Modern fonts. This is all about the use of unicode characters in your document. LaTeX (pdfLaTeX) needs a way to interpret what to do with the character.

Short of this work around, you're going to have to work with something like xelatex which better handles non-ascii characters. The package unicode-math does this to some extent, but not in a manner accessible for pdfLaTeX.

For example, the following compiles quite fine under xelatex




But it compiles because unicode-math already told xelatex how to handle the glyph .

You might want to look at Entering unicode math symbols into LaTeX, direct from keyboard, on a Mac to see more about how to implement this.

If this is still not what you want, I can not stress enough the importance of supplying a MWE that reflects what you're doing on your end. It helps us better understand what you're trying to do; otherwise, it can be like shooting in the dark --- particularly if we're not understanding each other's lingo in the same way.

  • 1
    Thanks for trying to help. I appreciate it. Unfortunately you seem to missing the point still. I want to use pdfLaTeX not XeTeX or LauTeX as I have explained in the question. I am also not trying to use an input file which has Unicode in the source file. I want the output to have this character. I don't think MWE will help, but I will add something. – Kaveh Jul 8 '13 at 5:40
  • I added some code. I hope that it would help explain what I want to do. – Kaveh Jul 8 '13 at 7:04




$⟦ \left⟦f\right]$


enter image description here

  • It seems that you are just using \llbracket from the fourier package. – Kaveh Jul 8 '13 at 8:03

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.