Tag Info

Hot answers tagged

133

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


79

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


68

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


49

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


45

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


36

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


34

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


29

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


28

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


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


25

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


21

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


21

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


20

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


20

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


19

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


18

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


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

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}


17

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

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}


15

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


15

It looks like you are trying to change the sections font to sans serif and usual bold letters. If you want it to be in sans serif through out the document, then you can do it with sectsty package. \documentclass{article} \usepackage{sectsty} \allsectionsfont{\bfseries\sffamily} % <---- omitting \bfseries still gives bold font \begin{document} ...


15

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


15

You should not use \bf. Instead use {\bfseries ....}. \documentclass{article} \usepackage{amsmath} \begin{document} {\bfseries NTn} = Number of lines $\boldmath{NTn} + \mathbf{NTn} + \boldsymbol{\pi} + \pmb{\pi} $ = Number of lines. \verb|\boldsymbol| and \verb|\pmb| are provided by \verb|amsmath| package. Note that \verb|\mathbf| has no effect on ...


14

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.


14

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


14

You can select the font used for URL using \urlstyle. However bold font isn't supported out-of-the-box. You need to patch the required style definitions as shown below. You need to use a font which supports a bold+text-typer style (expect you want to have the URLs in normal Roman style). You need to mark the parts of the URL which is different with a ...


14

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