Reputation: 215
A font I am using does not have the slanted/oblique variant to it in LaTeX (NB: not italics), and I would like to have slanted text in places.
Is there an easy way to slant text without having to generate entirely new font files and such?
One suggested solution was to do:
\renewcommand{\textsl}[1]{\tikz[baseline=(X.base)] \node[xslant=0.2231153] (X) {#1};}
This works well for one or two words, but tikz nodes don't break across lines, so it's not adequate, for, say, a theorem environment.
Obviously, a quick-and-dirty method will not give exceptional kerning or spacing, but I am not concerned about that. However, a 13 degree shear/slant would be desirable.
Upvotes: 7
Views: 7052
Reputation: 111
The XeLaTeX/fontspec answer mentioned above somehow wouldn't work for me, so I came up with this:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newcommand{\slsc}[1]{\fontspec[SmallCapsFeatures={FakeSlant=0.6}]{Linux Libertine O}\textsc{#1}\fontspec[]{Linux Libertine O}}
\begin{document}
normaltext
\textsc{textsc}
\slsc{textslsc} % this will produce slanted small caps
\end{document}
Upvotes: 0
Reputation: 166
Here are some macros for shearing, but that will not be what you want either, I guess.
\usepackage{graphicx} %\hshearbox{vertical_prescale_times_shearfactor}{one_divide_by_shearfactor}{content} % an initial vertical downscale is often necessary for a 3d projection \newcommand{\hshearbox}[3]{\scalebox{0.866025}[#2]{\rotatebox{210}% {\scalebox{1.73205}[-0.57735]{\rotatebox{60}{\scalebox{-1.1547}[#1]{#3}}}}}} %\vshearbox{horizontal_prescale_times_shearfactor}{one_divide_by_shearfactor}{content} % an initial horizontal downscale is often necessary for a 3d projection \newcommand{\vshearbox}[3]{\scalebox{#2}[0.866025]{\rotatebox{210}% {\scalebox{-0.57735}[1.73205]{\rotatebox{60}{\scalebox{#1}[-1.1547]{#3}}}}}}
Upvotes: 0
Reputation: 423
I use LuaLaTeX, but the following should also work with XeLaTeX. LuaLaTeX, from my experience, is fully backward compatible with good old LaTeX, and it's only marginally slower. And making new, clever macros is a breeze. Anyhow, enough proselytizing.
This is pulled almost directly from one of my documents. Some of it is hackish, yes, but it suits my needs well - and the results are quite respectable.
\usepackage{relsize} % For \texttt definition below
\usepackage{fontspec}
\setmainfont% Minion Pro, not redistributable?
[Ligatures=TeX,
SlantedFont=*,
SlantedFeatures={FakeSlant=0.2},
BoldSlantedFont=* Bold,
BoldSlantedFeatures={FakeSlant=0.2}
]{Minion Pro}
\setsansfont% Linux Biolinum O % SIL Open Font License
[Ligatures=TeX,
Extension=.otf,
BoldFont=fxbb,
ItalicFont=fxbri,
BoldItalicFont=fxbri,
BoldItalicFeatures={FakeBold=1.5}, % Note: This is not currently working in LuaTeX!
SlantedFont=fxbro,
BoldSlantedFont=fxbbo
]{fxbr}
\setmonofont[Ligatures=TeX]{DejaVu Sans Mono} % "Free License" No General Restictions
\makeatletter
\let\old@texttt\texttt
\renewcommand{\texttt}[1]{{\smaller\old@texttt{#1}}}
\makeatother
Upvotes: 3
Reputation: 64660
You can do this easily in XeLaTeX:
\usepackage{fontspec}
...
\fontspec[ItalicFont=*,ItalicFeatures=FakeSlant]{Minion Pro}
Highly undesirable, however, if there's any chance you can get a real italic.
Update: why undesirable? Because font outlines are not designed to be distorted! Any sort of transformation besides linear scaling in both directions will change the relationship between the inner/outer curves of the letters, effectively going against the wishes of the font designer.
If you want to highlight something in a different font than the roman and not use italic, try something completely different like a harmonising sans serif, for example.
Upvotes: 10
Reputation: 24662
Use a font that does have italics. Standard fonts are best unless you're in marketing.
Upvotes: 6