Home > Archive > Tex > August 2005 > Measuring things with xspace and microtype
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Measuring things with xspace and microtype
|
|
| Jellby 2005-08-29, 7:04 pm |
| Hi again,
I'm now trying to right-align some lines inside a text. The problem is one
of the lines is not completely flushright, but there has to be some space
so that what's inside the guillemets remains aligned. In other words, I
want to get something like this (fixed-width font):
« La Houdiničre,
« Capitaine des gardes. »
The obvious way to get this is having a \phantom{»} at the end of the first
line, and this does actually work... unless I have xspace and microtype
packages loaded. I have managed somehow to get the lines aligned with the
code below, but it involves disabling character protrusion, and I find it
rather inelegant. Is there some way to get the protrusion amount for the
"»" character? Or maybe some other way to achieve what I want?
Thanks
P.S. Painting the "»" white works, but then the character is there, and it
appears when copying tex or converting the pdf.
=========================== 8< ===============================
documentclass{memoir}
\usepackage[francais]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xspace}
\usepackage{microtype}
\makeatletter
\initiate@active@char{«}
\initiate@active@char{»}
\AtBeginDocument{%
\def«{\og\ignorespaces}%
\def»{\fg}%
}%
\makeatother
\newlength{\spacelength}
\settowidth{\spacelength}{~}
\newcommand{\phantomfg
{\microtypesetup{protrusion=false}\hspac
e{-\spacelength}\phantom{»}}
\begin{document}
\section{First quote}
\begin{quotation}
«M. d'Artagnan, garde du roi, compagnie des Essarts, est attendu au
Palais-Cardinal ce soir ŕ huit heures.
\flushright
«La Houdiničre,\phantomfg\\
«Capitaine des gardes.»
\end{quotation}
\section{Second quote}
\begin{quotation}
«M. d'Artagnan, garde du roi, compagnie des Essarts, est attendu au
Palais-Cardinal ce soir ŕ huit heures.
\flushright
«La Houdiničre,»\\
«Capitaine des gardes.»
\end{quotation}
\end{document}
=========================== 8< ===============================
--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \
http://djelibeibi.unex.es
/________\ \ \
jellby \___________\/ yahoo.com
| |
|
| On 29.08.2005 18:32, Jellby wrote:
> Hi again,
>
> I'm now trying to right-align some lines inside a text. The problem is one
> of the lines is not completely flushright, but there has to be some space
> so that what's inside the guillemets remains aligned. In other words, I
> want to get something like this (fixed-width font):
>
> « La Houdiničre,
> « Capitaine des gardes. »
>
> The obvious way to get this is having a \phantom{»} at the end of the first
> line, and this does actually work... unless I have xspace and microtype
> packages loaded. I have managed somehow to get the lines aligned with the
> code below, but it involves disabling character protrusion, and I find it
> rather inelegant. Is there some way to get the protrusion amount for the
> "»" character? Or maybe some other way to achieve what I want?
I don't know whether this would be less inelegant but there you go
(\guillemotright is in slot numer 20 in T1 encoded fonts):
\newcommand\phantomfg{%
\hskip\dimexpr-\rpcode\font 20 em / 1000\relax
% or, if etex is not available:
\@tempdima=\rpcode\font 20 em
\divide\@tempdima by 1000
\hskip-\@tempdima\relax
% cancel \xspace:
\phantom{»{}}%
}
Regards,
Robert.
| |
| Jellby 2005-08-30, 3:57 am |
| Among other things, RS saw fit to write:
> I don't know whether this would be less inelegant but there you go
> (\guillemotright is in slot numer 20 in T1 encoded fonts):
>
> \newcommand\phantomfg{%
> \hskip\dimexpr-\rpcode\font 20 em / 1000\relax
> % or, if etex is not available:
> \@tempdima=\rpcode\font 20 em
> \divide\@tempdima by 1000
> \hskip-\@tempdima\relax
> % cancel \xspace:
> \phantom{»{}}%
> }
Good, this seems to work fine. I would have sweared I had tried "»{}" to
avoid the xspace problem, but maybe I hadn't.
So, now I know the (right-margin) protrusion distance is "stored" in
\rpcode, in units of 0.001em (as it says in the pdfTeX manual), and how to
access it :-)
Thanks
--
Ignacio __ Fernández Galván
/ /\
Linux user / / \ PGP Pub Key
#289967 / / /\ \ 0x01A95F99
/ / /\ \ \
http://djelibeibi.unex.es
/________\ \ \
jellby \___________\/ yahoo.com
|
|
|
|
|