Tag Info

Hot answers tagged

140

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


85

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


70

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


53

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


51

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


37

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


35

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


30

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


29

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


27

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


26

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


26

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


22

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


22

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


21

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


21

The caption package provides a lot of functionality and I would recommend to use it. Depending on your LaTeX distribution there a different ways to get the package. You get the files here, but installing is not trivial. You might want to search 'tex.sx' for 'install package' and pick you system. You get Figure x.x bold with ...


21

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


20

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


19

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


19

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}


18

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


18

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


16

In my experience, there is no single best way. Therefore Table 327 on page 113 of the Comprehensive LaTeX Symbol List comes in really handy.


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

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


16

Using the bm package. The \mathbf command can be used only for non-italic symbols, instead the amsmath package defines the \boldsymbol command that can be used whit every literal symbol or math operator. The bm package redefines the \boldsymbol command providing the \bm command and is indipendent from amsmath. So you can use: \documentclass{article} ...


15

It depends on what you want the verbatim to support. If you simply want to put some normal text in "verbatim" (typewriter) font, then use \texttt. If you want to allow special characters such as _, &, or ^ to be displayed as is, then \listinline (which xport mentions) may be enough, and allows to customize the font somewhat. However, # or % will still ...


15

If you use the package bm you can do $\bm{a}=\bm{\alpha}$ etc.


15

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



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