Hot answers tagged

360

Marc van Dongen gave a great answer. I'll throw in another reason: \it and \bf do not play well together. That is, they do not nest as one would intuitively expect: Whereas \textit and \textbf do play well together: This is nice. However, you may notice that it still fails to handle nested style adjustments to small caps, since the Computer Modern fonts ...


197

In my experience, there is no single best way. Therefore Table 528 on page 225 of the Comprehensive LaTeX Symbol List comes in really handy. (Visited March 8, 2019 )


55

With unicode-math you can use \symbf{<characters>} which works for both Greek and Latin letters. (In versions of unicode-math older than 0.8 the \symXXX macros didn't exist, but you could \mathbf{<characters>} directly.) Compile with xelatex or lualatex. \documentclass{article} \usepackage{unicode-math} \setmathfont{xits-math.otf} \begin{...


51

First of all you should not use the obsolete \bf or \it macros from LaTeX2.0. They do not use the new font selection scheme (NFSS) of LaTeX2e. So \bf will do bold and bold only, but will not mix with an italic setting, which makes bold-italic impossible. Use the new \bfseries macro instead. There is not much practical difference between \textbf{<content&...


49

You can patch the name:last, name:first-last and name:last-first macros defined in biblatex.def. These are used by all of the default name formatting directives and take four arguments: {<last name>}{<first name>}{<name prefix>}{<name affix>} or {<last name>}{<first name (initials)>}{<name prefix>}{<name affix&...


47

Here's a solution that I've found to work very well -- add the following to your document preamble \makeatletter \g@addto@macro\bfseries{\boldmath} \makeatother (or just add the middle line to a .sty/.cls file, where the at-symbol escaping isn't needed.) This just modifies that \bfseries macro to include \boldmath. You also need to make sure that your font ...


44

Since biblatex 3.4/biber 2.5, there is a general "annotation" functionality to do things like this, for example: \documentclass{article} \usepackage{biblatex} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @MISC{test, AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3}, AUTHOR+an = {2=highlight}, } \end{filecontents} \...


44

\documentclass{article} \usepackage{xcolor} \begin{document} ~\\ \colorbox{pink}{highlight}\\ \colorbox{green}{highlight}\\ \colorbox{yellow}{highlight}\\ \bfseries\colorbox{pink}{highlight + boldface}\\ \colorbox{green}{highlight + boldface}\\ \colorbox{yellow}{highlight + boldface}\\ \color{red}\colorbox{pink}{highlight + boldface + colored text}\\ \...


43

There's a really cheesy way of saving keystrokes that is no longer than Todd's answer but just as comprehensive as Yiannis's: \documentclass{article} \def\*#1{\mathbf{#1}} \def\ab{ab} \begin{document} $\*v, \*w, \*\ab, \*\Gamma$. \end{document} Explanation: a control sequence whose name is a non-letter doesn't require either spaces or braces after it (...


35

If you want the whole item bold, you can write: \begin{enumerate}\bfseries \item The firs item \item The second item \end{enumerate} If you want the number to be bold, you can do it by using the enumitem package and setting: \begin{enumerate}[label=\textbf{\arabic*})] \item The firs item \item The second item \end{enumerate} Check the enumitem package ...


33

There is also \boldsymbol{} from the package amsbsy (loaded by amsmath). See this question for a discussion of the advantages and disadvantages of each command.


33

There are the Latin Modern Fonts, from their README: The fonts are based on Donald E. Knuth's Computer Modern fonts in the PostScript Type 1 format In family lmtt, there are even three series: \documentclass{article} % \usepackage[T1]{fontenc} \usepackage{lmodern} \begin{document} \ttfamily \fontseries{l}\selectfont light \fontseries{m}\selectfont ...


31

Your issue is "font-dependent". Background Indeed, special shapes of a font (bold, italic, slanted, small caps) are not defined relatively to a main font (its regular shape), but independently. The "bold version" of a font is defined per se (it is an independent *otf, *.ttf-file you can install and use, even if you don't have the main/regular version), and ...


29

There is no difference in the font choice or italic correction applied and for common variants like bold and italic, it's probable that the fonts are preloaded so it makes no difference at all, however in principle \textit{\textbf{text}} first loads the italic font (and will generate warnings and substitutions if this font is not available) and only then ...


29

The recommended way to do this is to use \bfseries and make it robust using etoolbox \documentclass{standalone} \usepackage{etoolbox,siunitx} \robustify\bfseries \begin{document} \sisetup{detect-weight=true,detect-inline-weight=math} \begin{tabular}{S[table-format=1.2]S[table-format=2.2]} {A} & {B} \\ 1.01 & \bfseries 11.1\\ \bfseries 2.1 & 1....


29

Assuming you do want fixed line ends: \documentclass{article} \newcommand\dob[1]{\textbf{#1}} \newenvironment{boldfirst}{\obeylines\everypar{\dob}}{} \begin{document} \begin{boldfirst} Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ...


24

While \bm and \boldmath are some good options in LaTeX, modern packages for XeLaTex can give a lot more control over the fonts from the very beginning, without the need to use commands different from the standard \mathbf that every one expects naively to work the first time one tries to write bold italic characters. In XeLaTeX (part of TeXLive), the package ...


24

Fonts are identified by five attributes: encoding family series (weight) shape size For the first four attributes, LaTeX maintains "default" definitions, contained in \encodingdefault \familydefault \seriesdefault \shapedefault but also other commands Family defaults: \rmdefault, \sfdefault, \ttdefault Series defaults: \mddefault, \bfdefault Shape ...


24

Here's a more complicated version that tries to preserve kerning between the first two letters, as shown in the last two lines. As in Thruston's answer, accented first characters must be enclosed in braces. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{environ,expl3} \ExplSyntaxOn % with the help of \NewEnviron, boldfirst absorbs the % ...


24

Is there any reason(s) not to use \let to redefine \bf to \bfseries and \it to \itshape? Yes, there are good reasons. :-) With the above \let-based setup, {\bf\it ...} produces bold-italic. In contrast, in a plain-TeX document {\bf\it ...} produces italic text. If the goal is to make \bf and \it behave the same way in LaTeX and plain-TeX, the \let-based ...


24

BBB stands for blackboard bold, but "double struck" is also used (e.g. ℝ). However how it should be pronounced is another matter -- between reading out the markup ("dollar dollar backlash B B B space R") and the meaning of the symbol ("set of real numbers" is a big gap.


23

The commands \rm, \bf etc are called "deprecated" because they have been removed from the latex kernel. The way the commands work don't fit in the (much better) "new font selection scheme" (nfss) used by latex2e. A number of classes nevertheless provide the definitions for these commands, but the definitions differ. E.g. memoir: \@memoldfonterr {\rm }{\...


22

What I did, is to declare my own command for a vector, well its pretty basic, but you can add other features, like an arrow. \newcommand{\vect}[1]{\boldsymbol{#1}} And the usage: \vect{X} = \left[x_1,x_2,\ldots,x_n \right]^T returning:


22

A different option is to use the Latin Modern fonts, that sport a fully featured boldface typewriter font. They have also another feature, because they can use a lighter version for the medium weight: \usepackage[lighttt]{lmodern} Let's compare a couple of examples: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \begin{document} ...


22

Using the fancyvrb package, with the commandchars option you can introduce escape sequences in verbatim code; in particular, you can get boldfaced fonts (provided you are using a suitable font. Using the codes option you can specify catcode changes ; in particualr, this allows you to include formatted mathematics in verbatim text: \documentclass{article} \...


Only top voted, non community-wiki answers of a minimum length are eligible