[Tex/LaTex] How to use fontspec and also have small bold caps with LuaLaTeX

boldfont-encodingsfontspecluatexsmall-caps

I was told by the Latex gurus that I should use \usepackage{fontspec} when using lualatex.

But now my small bold caps do not work: they come out only bold, but not caps,
even though I added \usepackage[T1]{fontenc} which is needed to get this to work

\textbf{\textsc{bold small caps}}

But it no longer work because \usepackage{fontspec} is there.

Removing \usepackage{fontspec} and keeping \usepackage[T1]{fontenc} made it work (i.e. bold and also small caps)

Removing \usepackage[T1]{fontenc} and keeping \usepackage{fontspec} does not work: It becomes only bold, but not caps.

The question is, for lualatex only (I only use lualatex, not pdflatex), and if one is supposed to include \usepackage{fontspec}, how can one get small caps and bold? Does one really need \usepackage{fontspec} or can one get away with only \usepackage[T1]{fontenc} (too many packages, too much font confusion with Latex).

MWE

\documentclass[11pt]{article}

\ifdefined\HCode
  \usepackage[utf8]{luainputenc}
   \usepackage[T1]{fontenc} %watch out, Makes tex4ht \verb not accept  different fonts. bug
\else
    \usepackage{fontspec}%for lualatex case
    \usepackage[T1]{fontenc}%needed for small cap bold
\fi   

\begin{document}

\textbf{\textsc{bold small caps}}    
\end{document} 

and

lualatex foo.tex

This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2016/03/31> patch level 2
....
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))

LaTeX Font Warning: Font shape `T1/lmr/bx/sc' undefined
(Font)              using `T1/lmr/bx/n' instead on input line 13.

[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./foo.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

)
...
/texmf-dist/fonts/type1/public/lm/lmr10.pfb>
Output written on foo.pdf (1 page, 39002 bytes).
Transcript written on foo.log.

TL 2016

Best Answer

It is completely wrong to say that you need a particular font encoding to get small caps.

the issue is that CM Unicode includes bold small caps, but the (otherwise recommended) latin modern does not.

So you want cm unicode not latin modern (which is the default with fontspec)

enter image description here

\documentclass[11pt]{article}


    \usepackage[tuenc]{fontspec}%for lualatex case

\setmainfont{CMU Serif}

\begin{document}

  not bold or caps

\textsc{small caps}    

\textbf{\textsc{bold small caps}}

\textbf{bold}

\end{document}