Tag Info

Hot answers tagged

66

By general request (or something of the like at least), I made it an answer. The C++ FAQ mentions this specific problem: http://www.parashift.com/c++-faq-lite/misc-environmental-issues.html#faq-40.2. The two things they wish to provide are a better typesetting and prevention of line breaks, two possibilities are given: ...


28

Edit - using the new package: With the package fnpct now available just use \usepackage{fnpct} and make sure the punctuation marks follow the footnotes: \documentclass{article} % for demonstration purposes only: make the page small! \usepackage[ paperwidth=.5\textwidth, paperheight=15\baselineskip, margin=5pt, bottom=1.5cm]{geometry} ...


22

Adjusting font kerning If you need to adjust the kerning within a font, the short answers are: No, not from within TeX. Yes, if you're willing to create a virtual font. Yes, if you're able to edit the font with fontforge (OpenType fonts only, for use in XeTeX or LuaTeX). Yes, if you're using LuaTeX and OpenType fonts; see §11 of the fontspec manual: ...


18

There is a long article about the challenges and tradeoffs involved in rendering crisp fonts at low resolution for screen: The raster tragedy. It seems that dvipng does not do subpixel positioning (which is an advantage because it means the individual glyphs can be made sharper, by careful hinting as done by freetype if your version of dvipng has this ...


18

If you want to maintain the kern but still keep your math expressions logically pure of sentence punctuation, and practically available for use in a document class that uses different text and math fonts, you could add a hand correction after the math, but in practice I'm not sure you'd want to do this: \documentclass{article} ...


18

For Classic TeX using tfm files the kerning and ligature information is in the ligtable in the tfm file. That is a binary file but there is a human readable version of it "property list" format, and a tftopl utility to convert the file: On the command line (texlive version, other implementations may vary slightly) tftopl cmr10.tfm Produces a long list of ...


17

Personally, I like the look of C\texttt{++} the best. It's also very simple!


16

With LuaTeX, you can patch fonts on the fly in arbitrary ways: \documentclass{minimal} \usepackage{fontspec} \usepackage{luacode} \begin{luacode*} local function add_exclam_kern(fontdata) if fontdata then local chars = fontdata.characters if chars then local ch = chars[33] if ch then if not ch.kerns then ch.kerns = ...


16

You can use microtype: \documentclass{article} \usepackage[kerning=true]{microtype} \SetExtraKerning {encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2}} % all text { \textemdash = {167,167} % thinspace = 1/6 em } \begin{document} Single hyphen in text mode: text-text, and in math mode: $a-b$. Double hyphen in text mode: text--text, ...


15

(Obligatory Bringhurst reference warning) Bringhurst has a few challenging comments about footnotes, including a mild "don't do that", but the relevant one for this question is (The Elements of Typographic Style, v3.2, pp68-69): 4.3.2 Check the weight and spacing of superscripts. ... "Superscripts frequently come at the ends of phrases or sentences. If ...


14

One way to shift your numerators in an italic context would be {\hss\tiny\kern\fontdimen\@ne\font#2\/\kern-\fontdimen\@ne\font\hss}\cr% Emit numerator [#2] as for safe ways of looking ahead and adding space or not, you might want to look at latex's definition of \DeclareTextFontCommand which defines \textit and friends to add italic correction at ...


14

The way that units are typeset in siunitx means that they are 'hidden' from any kerning: they are inside a box, which then has various math mode switches. That's required in order to be sure you can control the font weight (bold is tricky to deal with). As a result, you will have to kern such cases by hand. (As an aside, it's arguable that the units are ...


13

Define a special behavior for the slash: \documentclass{article} \usepackage{url} \makeatletter \def\Url@twoslashes{\mathchar`\/\@ifnextchar/{\kern-.2em}{}} \g@addto@macro\UrlSpecials{\do\/{\Url@twoslashes}} \makeatother \begin{document} \urlstyle{sf}\url{http://tex.stackexchange.com/4427} \bigskip \urlstyle{rm}\url{http://tex.stackexchange.com} ...


13

\kern is a TeX primitive which awaits a dimension expression, while \widthof is a calc package function which only works in \setlength and friends. It requires internal box assignments, which are not allowed in a normal dimension expression. You can't therefore use \widthof and other things like this at positions where TeX dimension expressions are awaited. ...


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.


12

It looks better with \lstset{flexiblecolumns=true}


12

Three suggestions: See Why is \[ … \] preferable to $$? Define a macro/command if you're using something multiple times. It promotes consistency and would make your life much easier if you decide to change things later on, even just a little bit. For example, \itemmul{<mat1>}{<mat2>}. As reference, see Consistent typography. You can modify the ...


12

The url package has a way how to do search-and-replace in the url strings. See the self-documented code. We tweak into \Url@acthash because it's called by \url exactly at the right place. \documentclass{article} \pagestyle{empty} \usepackage{url} \usepackage[T1]{fontenc} \usepackage{lmodern} \makeatletter % nice "//" ...


12

This should do what you want. Of course, you can choose the command name (\twobar) and the amount of kerning (–0.2em): \documentclass{article} \newcommand{\twobar}{/\kern-0.2em/} \begin{document} {\sffamily http://www.jb.com.br http:\twobar{}www.jb.com.br } \end{document}


12

Mico's shown a possibility of using one of the unicode TeX engines, but to answer you explict questions, and using pdftex, you are not doing anything wrong, and TeX isn't adding space anywhere (as you can see from the log output generated by the code below. the side bearings on teh M are equal, but the - is not centred. TeX has no knowledge of this, to TeX ...


12

That probably will break all sort of things … … for example \kern--.15em and \csname --Y\endcsname. Related: Easily assign undefined ligatures with pdfLaTeX? Code \documentclass{article} \usepackage[english]{babel} \makeatletter \languageshorthands{english} \initiate@active@char{-} \defineshorthand{--}{% \char`-\char`-% ...


12

The definitions from source2e (the listing of the LaTeX kernel): % the TeX logo \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} % the LaTeX logo \DeclareRobustCommand{\LaTeX}{L\kern-.36em% {\sbox\z@ T% \vbox to\ht\z@{\hbox{\check@mathfonts \fontsize\sf@size\z@ \math@fontsfalse\selectfont A}% \vss}% }% \kern-.15em% \TeX} % the LaTeX2e logo ...


12

If you modify your MWE to use article (to avoid artefacts of standalone) and add \showoutput to your document you will see that Text & MV/m \\ produces ........\T1/ppl/m/n/10 M ........\T1/ppl/m/n/10 V ........\T1/ppl/m/n/10 / ........\T1/ppl/m/n/10 m So there is no font-specified kern between V and / in that font. equation & $MV/m$\\ ...


12

The newunicodechar was written with this application in mind: directly typing characters with "strange" accents that are not covered by the standard utf8 option to inputenc, in particular vowel length for Latin. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{color} \usepackage{newunicodechar} %\newunicodechar{ă}{\u{a}} % not needed ...


12

A little guide to feature files With feature files you can define two types of operation in lookups: substitute (sub) glyphs by others and position (pos) glyphs. What is impossible, is to modify the letterforms or add missing glyphs. Also, wrong encoding can’t be corrected by feature files. The only thing one can do in this case is to a glyph by another ...


12

At \scriptscriptstyle the output is not satisfying, but I don't think you need it. \documentclass{article} \usepackage{amsmath} \makeatletter \def\mov@rlay#1#2{\leavevmode\vtop{% \baselineskip\z@skip \lineskiplimit-\maxdimen \ialign{\hfil$\m@th#1##$\hfil\cr#2\crcr}}} \newcommand{\charfusion}[3][\mathord]{ #1{\ifx#1\mathop\vphantom{#2}\fi ...


11

Microtype's kerning option is intended to set additional kerning around individual characters. You have to specify those characters and kerning amounts with a \SetExtraKerning command. It is not done automatically and there is no optical kerning (except in your own eyes when you make such a setting). The configuration file microtype.cfg does this for a few ...


11

It is probably overkill, but I usually use siunitx. Here is an example \documentclass{article} \usepackage{siunitx} \sisetup{ group-four-digits = true, group-separator = {,} } \begin{document} I looked in my bank account and saw \SI{15}[\$]{M}! But then I woke up, and there was only \SI{457.34}[\$]{}. I cried a little, but then I got paid and there ...


11

You should really be using the T1 encoding for writing in German. Try \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage[sc]{mathpazo} \usepackage[ngerman]{babel} %\DeclareTextCommand{\glqq}{T1}{% % \textormath{\quotedblbase\nobreak\hskip0.05em\relax } % {\mbox{\quotedblbase\kern0.05em }}} %\DeclareTextCommand{\grqq}{T1}{% % ...


11

OpenType has among the standard font features tnum for “Tabular Figures” vs. pnum for “Proportional Figures”. (This is distinct from, and orthogonal to, the choice of lnum “Lining Figures” vs. onum “Oldstyle Figures”.) The OpenType-capable TeX engines LuaTeX & XɘTeX can access these glyphs if the font you’re using supports those features. Try this ...



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