Home > xetex > \addfontfeatures attribute lost after next fontspec command (like \textbf{})

\addfontfeatures attribute lost after next fontspec command (like \textbf{})

April 14Hits:2
Advertisement
  1. I'm using Linux Libertine font (from system) with XeTeX.
  2. In the body, I'm using OldStyle numerals while I want Lining numerals in the tables.
  3. I'm typesetting tables that have some cells with \bfseries text.

However, the \addfontfeature setting is only applied to regular text, but not text that is set in \bfseries.

MWE

\documentclass{scrartcl} \usepackage{array,booktabs,fontspec} \setmainfont[Ligatures={Common},Numbers={OldStyle}]{Linux Libertine O}  \begin{document} \begin{table}   \addfontfeature{Numbers={Lining}}   \begin{tabular}{>{\bfseries}ll} \toprule     3 & 3 \\ \bottomrule   \end{tabular} \end{table} \end{document} 

This yields:

\addfontfeatures attribute lost after next fontspec command (like \textbf{})

How can I set \addfontfeatures{Numbers={Lining}} to apply to all text in a group?

Answers

The problem is reproducible without a tabular:

\documentclass{scrartcl}
\usepackage{array,booktabs,fontspec}
\setmainfont[Ligatures={Common},Numbers={OldStyle}]{Linux Libertine O}

\begin{document}

1234567890

{\addfontfeatures{Numbers=Lining}

1234567890

\normalfont 1234567890

\bfseries 1234567890}

1234567890

\end{document}

\addfontfeatures attribute lost after next fontspec command (like \textbf{})

As you see, the call to \normalfont resets the features back to what's stated at the beginning. The \bfseries command does \fontseries{\bfdefault}\selectfont which nullifies the chosen feature.

My advice is to avoid \addfontfeatures whenever possible, even at the cost of some code duplication.

\documentclass{scrartcl}
\usepackage{array,booktabs,fontspec}
\setmainfont[Ligatures={Common},Numbers={OldStyle}]{Linux Libertine O}
\newfontfamily{\mainlining}[Ligatures=Common,Numbers=Lining]{Linux Libertine O}

\begin{document}

\begin{table}
\mainlining

\begin{tabular}{>{\bfseries}ll}
\toprule
3 & 3 \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

\addfontfeatures attribute lost after next fontspec command (like \textbf{})

Use

 \documentclass{scrartcl}
 \usepackage{array,booktabs,fontspec}
 \usepackage[oldstyle]{libertine}
 \defaultfontfeatures{Ligatures=Common}
 \begin{document}

\begin{table}[!htb]
\libertineLF
 \begin{tabular}{>{\bfseries}ll} \toprule
            123 & 31234 \\ \bottomrule
 \end{tabular}
\end{table}

 \end{document}

\addfontfeatures attribute lost after next fontspec command (like \textbf{})

Tags:xetex, fontspec

Related Articles

  • \addfontfeatures attribute lost after next fontspec command (like \textbf{})

    \addfontfeatures attribute lost after next fontspec command (like \textbf{})April 14

    I'm using Linux Libertine font (from system) with XeTeX. In the body, I'm using OldStyle numerals while I want Lining numerals in the tables. I'm typesetting tables that have some cells with \bfseries text. However, the \addfontfeature setting is onl

  • querying whether a font feature has been activated via a fontspec command

    querying whether a font feature has been activated via a fontspec commandNovember 11

    A LaTeX package I'm currently writing makes use of -- and definitely requires -- some of the power of LuaLaTeX. I would like to make my package's user interface -- in particular, the options that need to be loaded -- as simple as possible by making t

  • How to remove "System File" attribute from a file without command prompt?

    How to remove "System File" attribute from a file without command prompt?April 19

    Is it possible to take away a file's "system" file attribute without using command prompt? Basically, I want to do this: attrib "folder" -s attrib "file" -s without using command prompt, or a batch file. Windows explorer prop

  • How to delete by attribute from shapefile in SAGA commandJanuary 18

    I have lot of shapefiles to erase polygons with same attribute form them. It is usually an easy task when do manually, but how can I use SAGA-GIS command? Any help? --------------Solutions------------- Not a SAGA-GIS user but looking at the Module Li

  • Is this a fontspec bug or a font bug February 13

    I'm using the Linux Libertine font and have old style numbers enabled. However, in a certain context I want to use lining figures instead. Normally I should be able to switch using \addfontfeature but this doesn't work. MWE: \documentclass{minimal} \

  • addfontfeature{Numbers=OldStyle} doesn't always work February 13

    I'm using the Linux Libertine font and have old style numbers enabled. However, in a certain context I want to use lining figures instead. Normally I should be able to switch using \addfontfeature but this doesn't work. MWE: \documentclass{minimal} \

  • With fontspec, how can one define a variation of a font family?

    With fontspec, how can one define a variation of a font family?July 29

    I keep running into the following situation using fontspec with XeTeX: I define a "base" font family using \newfontfamily. I then want to access a "spaced small caps" variant, using the LetterSpace feature within the SmallCapsFeatures

  • Is using \addfontfeatures (much?) less efficient than defining a \newfontface?August 22

    Consider the following file: \documentclass{article} \usepackage{fontspec} \setmainfont[Numbers={Lining,Proportional},Ligatures=Common]{EB Garamond} \newfontface\garamondoldstylenumbers[Numbers={OldStyle,Proportional},Ligatures=Common]{EB Garamond} \

  • Meaning of fontspec related errorMarch 14

    I've edited a document. The edited document works well on my system, but apparently reports this error on another system: Undefined control sequence. <argument> ...ontspec_tmp_int\endcsname 255*\real{0.5}\relax What is this error about? The error ap

  • Use of \scshape or \textsc with fontspec/xelatex

    Use of \scshape or \textsc with fontspec/xelatexMay 16

    I've already tried Use of \scshape or \textsc in beamer \institute fix with \rmfamily in the MWE below, but it doesn't work - I've seen A problem with \textsc as well, but I don't think I should load fontenc now that I'm using fontspec with xelatex.

  • Exchange 2010 powershell - select custom attributesJune 14

    How do I select the custom attribute from the Exchange powershell command get-mailboxstatistics? I would have expected to use something along the lines of get-mailboxstatistics -server dbserver | select DisplayName, ItemCount, {$_.TotalItemSize.value

  • Cygwin does not see Windows share as folder - no "d" attribute?January 8

    I migrated this question from StackOverflow as it really fell outside the scope of programming questions they generally prefer, so hopefully I'll find a more suitable audience here... I've installed Cygwin 1.7 on a Windows Server 2008/64 box in suppo

  • Adobe Caslon Pro, XeLaTeX, fontspec - how to change the "dollar" symbol that's used with oldstyle numbers

    Adobe Caslon Pro, XeLaTeX, fontspec - how to change the "dollar" symbol that's used with oldstyle numbersMarch 13

    I am using XeLaTeX with Adobe Caslon Pro, and I would like to have oldstyle numbers. But when I use the option Numbers=OldStyle in fontspec, my dollar sign changes from a full-height S with two lines through it to a tiny s with only one line through

  • Change a virtual machine Notes attributes in esxi shellJuly 18

    I have tried to change via ESXi shell the attribute field with the following command: vmx -s attributes=new notes /vmfs/volumes/datastore1/VM/VM.vmx but it doesn't change the attributes and doesn't give me any error. Is there any command to do that?

  • How to export QGIS contour attributes in a DXF file?January 24

    I'm new to this. I have a .tiff data file that generates contours in QGIS. I save it as .dxf. The contours don't have any attributes or data. That's bad, because I want to make a 3D landscape in Revit using the information. How do a save/export the c

  • How do I stop a bash shell PS1 color to stop at the end of the command?

    How do I stop a bash shell PS1 color to stop at the end of the command?July 23

    So simple question really, I have a custom PS1 colour where I have the actual shell commands in a distinct colour, just so I can quickly see what commands I typed and separate it from the command output itself. Here is the problem, suppose the colour

  • xmltex more attributes in elementNovember 21

    I am just working on my graduating thesis, when I making a new latex style for typesetting legal XML documents. I have my new latex style, which is overworked [article] with new commands and source legal XML file. I use a xmltex. When I mapping XML t

  • No \textbf commands available + text in borders

    No \textbf commands available + text in bordersJune 25

    I am using the following packages for my simple document: \usepackage{newtxtext} \usepackage{newtxmath} \usepackage[T1]{fontenc} \usepackage[polish]{babel} \usepackage{xunicode} \usepackage{xltxtra} \usepackage[usenames,dvipsnames,svgnames,table]{xco

  • Is it normal that I need u+w to set extended filesystem attributes?June 29

    I noticed that on panfs, Pythons copystat fails when the source file does not have the u+w permission bit set; setting attributes fails with Permission denied command line equivalent: (attr_set: Permission denied). Considering that for "normal"

  • How does fontspec select fonts "by name"?August 22

    When loading a font by name, what is the search mechanism being used? How is the matching done? (It's marked TODO in the documentation) I have many problems, for example: a "Hoefler Text Engraved" font is replacing the default "Hoefler Text

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.470 s.