Tag Info

Hot answers tagged

116

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


76

Those are very different commands even if the output happens to look the same. If you want to emphasize a word or some text, use \emph. Don't just make the text italic or bold. If needed, you may change the behaviour of \emph whenever you wish in the preamble and the whole document will be adjusted accordingly. If you want to get italic text, use \textit. ...


44

The \emph macro is designed to be semantic mark up. So while convention it makes text italic, this is not always the case. For example, the beamer class makes \emph text red as this works better in presentations than using italic. On the other hand, \textit makes text italic, with no variation. Thus it is intended for making text italic when that is exactly ...


41

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


35

Using "all italics" is unfortunately an often committed sin. You should italicize only variables. Everything else should be upright. For example: function names (sin, cos, log, ln etc...) dimensionless numbers (Re, Pr, Ra...) exact infinitesimal increments (dx, dy et... in BOTH integrals and differentials) descriptive text all descriptive variable indices ...


35

When both attributes differ, slanted is an oblique version of the roman font; the shape is basically the same but "sloped". Italics, on the other hand, have different letter shapes. The following example shows the difference: \documentclass{article} \begin{document} \Huge Some text \textit{Some text} \textsl{Some text} \end{document} Notice that ...


31

\itshape is a switch: Not italic {\itshape Italic} Not italic \textit takes an argument: Not italic \textit{Italic} Not italic Many people seem to like \itshape{...}, which is wrong (but doesn't give an error since the braces are interpreted as grouping delimiters here). \itshape doesn't automatically insert italic correction, whereas \textit does, so ...


27

A LaTeX3 solution. I chose to simply do what you said, replacing every ( by \textup{(}, every ) with \textup{)}, and similarly for brackets, prior to passing the result to the old version of \emph for typesetting. At the end of the day, xparse allows us to easily define \emph to do what you asked for, and \emph* to do the old version of \emph. ...


26

I would agree not messing with catcodes (although doing so just within an \emph command itself probably wouldn't have too many issues.) But here's a relatively simple solution with a slightly more transparent semantics than Yiannis's solution: \documentclass{article} \newcommand{\bemph}[1]{{\upshape#1}} % define how emphasised brackets should look ...


22

amsthm has three separate predefined styles: \theoremstyle{plain} is the default. it sets the text in italic and adds extra space above and below the \newtheorems listed below it in the input. it is recommended for theorems, corollaries, lemmas, propositions, conjectures, criteria, and (possibly; depends on the subject area) algorithms. ...


22

Quoting Bringhurst's “Elements of Typographic Style” section 3.5.2 Don't clutter the foreground: When boldface is used to emphasize words, it is usually best to leave the punctuation in the background, which is to say, in the basic text font. It is the words, not the punctuation, that merit emphasis in a sequence such as the following: ... on the ...


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


19

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


19

\itshape is a declaration. It affects the following text. That's why it's often used for larger amounts of text or within a group. In contrast, \textit affects only its argument. \textit provides italic correction, \itshape does not. This means, that immediately after an italic text made by \textit there's a little more space before the following text, ...


18

With version 2.5 of the microtype package, available on CTAN since 13 March 2013, the simple answer to my question is "use microtype". Thanks, Herbert and Joseph, for telling me that this can be done with the microtype package. I did know that microtype can do margin kerning, but I had always thought that this is only about punctuation. In reality, one ...


17

microtype has an optional argument that you can allow to shift the characters more to the right, e.g. [factor=1300] \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lmodern,picture} \usepackage{microtype} \textwidth=3.85cm \begin{document} \itshape\noindent\makebox(0,0){\put(\textwidth,-2cm){\line(0,-1){80}}}% This is a small text. If jam is ...


17

For the case of units, you should use the siunitx package. \documentclass{article} \usepackage{siunitx} \begin{document} The average time of this event is \SI{50}{\micro\second}. \end{document} I guess I should mention the upgreek package. The average time of this event is 50~$\upmu$s. but this doesn't look as good.


16

The results are not always perfect, but mathastext is what you're looking for, when you want to set globally the math font to upright (or to use another completely different font, check the documentation): \documentclass{article} \usepackage[LGRgreek]{mathastext} \begin{document} Here is a formula: $x=\exp(\log x)$ Here is another: $\sin^2 t+\cos^2 t = 1$ ...


16

Use a combination of lmodern and slantsc to obtain slanted small caps: \documentclass{article} \usepackage{lmodern}% http://ctan.org/pkg/lmodern \usepackage{slantsc}% http://ctan.org/pkg/slantsc \begin{document} \renewcommand{\arraystretch}{1.5} \begin{tabular}{ll} \verb!\textsc{Hello world}! & \textsc{Hello world} \\ % Regular Small Caps ...


15

\text is not the right command to use, as its argument will be typeset in the current font, which may be italics. \usepackage{amsmath} % for extended version of \textup \newcommand*{\Boltzmann}{k_\textup{B}} $\vec{F}_\textup{in}+\vec{F}_\textup{out}=\vec{0}$ What subscripts are to be set in upright font and what in italics is well explained by Boffin. (I ...


15

OK, I produced an absolutely crazy "solution" myself. This is mostly to make clearer what the problems are; I wouldn't suggest using the (very long) code below. This "solution" only provides italic correction for single letters A to Z and a to z, and it works by making $ active. (I could also have used \( and \), but I don't like those.) Moreover, everything ...


14

You can simply redefine the command \thefootnote which is responsible of the footnote superscript. Either \renewcommand{\thefootnote}{\textit{\alph{footnote}}} or \renewcommand{\thefootnote}{\emph{\alph{footnote}}} should be fine (anyway don't use the latter if you're loading packages like ulem that redefine the meaning of \emph!): ...


13

Here's a solution that borrows from Joseph Wright's LaTeX3 solution to Defining starred versions of commands % arara: pdflatex \documentclass{article} \usepackage{amsmath} \usepackage{xparse} \let\oldeqref\eqref \makeatletter \RenewDocumentCommand\eqref{s m}{% \IfBooleanTF#1% {\textup{\tagform@{\ref*{#2}}}}% If a star is seen {\oldeqref{#2}}% ...


13

This is fixed in the mathtools package (see section 4.1 of the package documentation). Here is an example. Note that math must be typed using \( and \): \documentclass{article} \usepackage{amsmath,mathtools} \begin{document} Bad: \mathtoolsset{mathic=false} \textit{If \(U\) or \(V\) \dots.} \par Good: \mathtoolsset{mathic=true} \textit{If ...


13

This could be related to a bug with negative protrusion values that I reported a year ago and which is obviously still open. Which luatex version are you using?


13

On a case-by-case basis, it is possible to typeset text within math mode using \textrm{...} or \mathrm{...}, the latter being used predominantly for typesetting units or symbols and not pure text (since it gobbles spaces that are not escaped). \mbox{...} is another alternative to \textrm{...}, since it resets its contents to text mode by default. Here are ...


12

This has nothing to do with the documentclass, but with font selection. \it selects non-bold italics, and \bf selects non-italic bold. You should use \textbf{\textit{vs}} instead. See also this question.


12

In both \mktextquote and \mkblockquote, add \iflanguage{english}{\itshape}{} at the appropriate position. (\iflanguage is a babel conditional.) \documentclass[fontsize=11pt]{book} \usepackage[frenchb]{babel} \usepackage{csquotes} \renewcommand{\mktextquote}[6]{% #1% \iflanguage{english}{\itshape}{}% ADDED #2#4#3#6#5% } ...


12

Expanding on the comments of Gonzalo Medina and egreg, I would recommend create the macro \code as such: \newcommand{\code}[2][ForestGreen]{\textcolor{#1}{\textit{#2}}} Then \code{text} and \code[red]{text} produce: Explanation: [2] so as to accept two parameters: #1 and #2. To provide a default color, we make the first one (#1) optional via ...


12

This is my suggestion: \documentclass{article} \usepackage{amsmath} \usepackage{siunitx} \begin{document} \begin{equation*} P_{\text{AVG}} = \SI{19.5}{\micro\watt} + \frac{\SI{2180}{\micro\joule}}{5 \cdot \SI{60}{\second} + \SI{0.2}{\second}} = \SI{26.77}{\micro\watt} \end{equation*} \end{document} (By loading the amsmath package, I can use text to ...



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