Tag Info

Hot answers tagged

48

Your question requires a two-part answer. \sc and \bf (and \it) are deprecated because, as you have noticed, they override each other. Use either \textit{...} \textbf{...} \textsc{...} or {\itshape ...} {\bfseries ...} {\scshape ...} instead. However, not all fonts contain italic and/or bold small caps (when they even contain small caps). (Also, ...


45

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 ...


43

The AMS Short Math Guide recommends the \boldsymbol and \pmb commands (and suggests that you use the bm package for the former to get a more powerful version than provided by amsmath).


30

Taking apan's comment and turning it into an example: \documentclass{article} \usepackage{array} \newcolumntype{$}{>{\global\let\currentrowstyle\relax}} \newcolumntype{^}{>{\currentrowstyle}} \newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}% #1\ignorespaces } \begin{document} \begin{tabular}{$l^c^r} \rowstyle{\bfseries} a & a & a \\ b ...


28

I guess you are using Adobe Reader? If you use transparency in your illustrations, it seems that Adobe Reader renders text incorrectly (something like the wrong gamma correction in anti-aliasing perhaps), which makes the text look a bit too bold. It should look OK if you use other PDF readers, and it should also look OK when printed from Adobe Reader. A ...


28

In general the command (\textbf/\textit) approach is more useful if the text is followed by more text on the same line and isn't followed by a small punctuation symbol. If the text is in a paragraph on its own or is followed by a small punctuation symbol, it doesn't matter really. In that case the declarations (\bf/\bfseries and \it/\itshape) are equivalent ...


25

For a job like this I usually define a convenience macro: \def\<#1>{\textbf{#1}} Now you can say \<ORS> without much overhead and still don't need to define macros for all the terms that are special. In the context of a book you might want to think about how this macro can be also used to create an index. (This is a little trickier and might ...


21

The \bm command from package bm has both advantages and drawbacks over the \boldsymbol command from package amsbsy (loaded by amsmath). The first advantage of \bm is that it keeps the italic correction, so that something like \bm{T}_1^2 will look better than \boldsymbol{T}_1^2 (if you want to compare the two in a document, you must be careful that bm ...


21

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 ...


20

This doesn't exactly answer your question (how to use bbold with AMS's black board bold characters). I believe that would require some TeX incantations. A cheaper work around is to use either the package bbm or the package doublestroke. The former defines the \mathbbm command and the latter uses the \mathds command, so they don't conflict with the AMS ...


16

Whoof, I found a solution myself - I share it with you guys, since I see many people are giving positive feedback to my question: \lstset{ morecomment=[n][\textbf]{In\ [}{]\:}, morecomment=[n][\textbf]{Out\ [}{]\:}, } \begin{lstlisting} In [27]: x=2, x=[123] Out [27]: 2 \end{lstlisting}


16

You can define your own \strong command which switches between strong and normal text like \emph does with italic: \documentclass{article} \makeatletter \newcommand{\strong}[1]{\@strong{#1}} \newcommand{\@@strong}[1]{\textbf{\let\@strong\@@@strong#1}} \newcommand{\@@@strong}[1]{\textnormal{\let\@strong\@@strong#1}} \let\@strong\@@strong \makeatother ...


16

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 ...


15

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 ...


14

Just to expand on Todd Lehman's answer, you can save a bit of typing in the definitions, by automating the creation of the commands: The LaTeX kernel has a looping construct named \@tfor that enables parsing a list of characters. We leverage this to define commands of the form \Va..\Vz and \VA..\VZ automatically using \csname..\endcsname. ...


14

Here's an idea using expl3: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{expl3,xparse} % turn expl3 space on: `:' and `_' are letters now and spaces % are ignored. To insert a space use `~'. \ExplSyntaxOn % declare a new sequence variable: \seq_new:N \l_pouya_boldfirst_seq % the internal command: \cs_new:Npn \pouya_boldfirst:n #1 { ...


13

I had the same question about a year ago. I came up with the following solution, which seems a bit cleaner that Juan's "hack": \DeclareSymbolFont{bbold}{U}{bbold}{m}{n} \DeclareSymbolFontAlphabet{\mathbbold}{bbold} Then one can use $\mathbbold{1}$ (and I store this, without the dollar signs, in the macro \ind since I use it as an indicator function).


13

Another possibility is \boldmath, though I would prefer \boldsymbol of amsmath as well. \unboldmath switches back to the normal math font.


13

\emph doesn't render always as \textit. It switches between upright and italic as you can see if you nest \emphcommands: \documentclass{article} \begin{document} abc \emph{some text \emph{emph} some text} \end{document} And there is no similar command which switches between bold and normal, but it would be easy to define. Simply copy the definition of \em ...


13

In lieu of a ton of \newcommands, I would rather define a macro that stores a number of words for which you require them to be bold. This is simply a comma delimited list. \documentclass{article} \usepackage{xspace} \begin{document} \makeatletter \def\boldcommandlist{\@elt FS,\@elt OFS,\@elt RS,\@elt ORS,\@elt NR,\@elt NF,\@elt FNR,} \def\@elt#1,{% ...


13

TeX does not kern between two different fonts. The bold and plain variants are from a different font (cmr10, cmb10). LuaTeX kerns across { and }, so {why}, gets its kerning, but not (see point 1) {\bf why},. PDFTeX (and older) behave as Knuth's TeX which does not kern across groups.


13

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 ...


12

I suggest Latin Modern Mono Light family. In Plain TeX: \font\tt=rm-lmtl10 \font\itt=rm-lmtlo10 \font\btt=rm-lmtk10 \font\bitt=rm-lmtko10 \tt Hello\par \itt Hello\par \btt Hello\par \bitt Hello\par \bye In LaTeX, it is lmtt family in OT1 font encoding. See ot1lmtt.fd for more information. Latin Modern fonts are available in Type1 and OpenType. ...


12

For bold and upright, you could use the regular text-version of \imath and \jmath, which are \i and \j: \newcommand{\ihat}{\hat{\textbf{\i}}} \newcommand{\jhat}{\hat{\textbf{\j}}} Additionally, if you want the \hat to be bold as well, then use \boldsymbol. \newcommand{\ihat}{\boldsymbol{\hat{\textbf{\i}}}} ...


12

As Martin mentioned in the comment you need a font which provides such a combination. In the following example you can see that the font courier has this combination implemented instead of Computer Modern. \documentclass{article} \usepackage{listings} \begin{document} % Default Computer Modern font (no bold implemented) \renewcommand{\ttdefault}{cmtt} ...


12

bm works for me: \documentclass{article} \usepackage{bm} \DeclareBoldMathCommand\boldlangle{\left\langle} \DeclareBoldMathCommand\boldrangle{\right\rangle} \begin{document} $ \left<a\right> $ $ \bm{\left<a\right>} $ $ \boldlangle a\boldrangle$ \boldmath $ \left<a\right> $ \end{document} Update after clarification from ...


12

The Open Type Version of Libertine has also a typewriter version. However, for pdflatex you can use the Bera Mono: \documentclass{scrartcl} \usepackage[T1]{fontenc} \usepackage{libertine} \usepackage[scaled=0.83]{beramono} \begin{document} This is a test with \texttt{some \textbf{bold} typewriter text}. \end{document} If you want Bera Mono for LuaTeX ...


12

This seems to be a good application of the RegEx features of LaTeX3: \documentclass{article} \usepackage{xparse,l3regex} \ExplSyntaxOn \NewDocumentCommand{\BoldFirst}{ m } { \pouya_boldfirst:n { #1 } } \cs_new_protected:Npn \pouya_boldfirst:n #1 { \tl_set:Nn \l_pouya_input_tl { #1 } \regex_replace_once:nnN { \A(.*?[A-Za-z]) } { \c{textbf}\cB\{ \1 ...


11

For the sake of completeness, when using unicode-math, \mathbf works for both Greek and Latin letters. Compile with xelatex or lualatex. \documentclass{article} \usepackage{unicode-math} \setmathfont{xits-math.otf} \begin{document} \( AaBb∇αβγ \) \par \( \mathbf{AaBb∇αβγ} \) \end{document}


11

You've already got a pretty good answer. Just in case you really wanted to use amsmath and bbold, the following TeX-hack seems to do the trick. \usepackage{amsmath} \usepackage{amsfonts} \makeatletter \def\amsbb{\use@mathgroup \M@U \symAMSb} \makeatother \usepackage{bbold} \begin{document} $\mathbb{1}, \amsbb{X}$ \end{document}



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