How can I get slanted text to the left instead?
Instead of the usual way slant/italic slants to the right.
Asked
Active
Viewed 2,865 times
4
Torbjørn T.
- 206,688
-
2have you tried anything yet? – Oct 14 '14 at 07:36
-
Not, yet. Looked around on the internet but couldn't seem to find anything. It's for a personal project so I didn't want to lose hours of time if anyone just knew the answer. – Oct 14 '14 at 07:54
-
1Welcome to TeX.sx! Your post was migrated here from [so]. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Nov 06 '14 at 19:24
-
What font? Slant is normally a property of the font. If it's a Metafont, you could do this; but we need more information to help. – dgoodmaniii Nov 06 '14 at 19:55
-
Related: How do I get fake slant (italics) with XeLaTeX? – Werner Nov 06 '14 at 20:41
-
Also, do you want entire paragraphs, or just some short text snippet to be slanted left? – Peter Grill Nov 06 '14 at 21:18
-
Werner's comment is probably your easiest answer; just set the slant to a negative value. – dgoodmaniii Nov 06 '14 at 21:41
-
There are fonts which feature a left-slanted shape. Those would probably give the best results if you can track down a suitable family. (Especially if this is for a significant amount of text rather than just the odd word.) – cfr Nov 07 '14 at 15:32
1 Answers
7
Taking Bruno's answer at Shear transform a "box", \slantbox[slant]{text} will give leftward slant for negative values of slant. The larger the absolute value of slant, the more the slant. I'm speculating that the value of slant is the tangent of the slant angle, relative to the vertical aspect.
The default is no slant, but once slant is set with the optional argument, it will persist for future invocations at that value until changed again in the optional argument.
This EDITED solution will line wrap. The code has be RE-EDITED to restore kerning and ligatures, by processing words, rather than characters at a time. However, hyphenation is not possible.
\documentclass{article}
\newsavebox\foobox
\def\slantvalue{0}
\newcommand{\slantboxengine}[2][\slantvalue]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\newcommand\slantbox[2][\slantvalue]{%
\edef\slantvalue{#1}\expandafter\slantboxhelpA#2 \relax\relax}
\def\slantboxhelpA#1 #2\relax{%
\slantboxengine{#1}%
\ifx\relax#2\relax\else\ \slantboxhelpA#2\relax\fi
}
\begin{document}
\slantbox[-.3]{%
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
NEW METHOD RESTORES LIGATURES
\slantbox{fififififi flflflflfl}
PRIOR METHOD:
\def\slantboxhelpA#1 #2\relax{%
\slantboxhelpB#1\relax\relax%
\ifx\relax#2\else\ \slantboxhelpA#2\relax\fi
}
\def\slantboxhelpB#1#2\relax{%
\slantboxengine{#1}%
\ifx\relax#2\else
\slantboxhelpB#2\relax%
\fi
}
\slantbox{fififififi flflflflfl}
\end{document}

Steven B. Segletes
- 237,551