Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have found an effect on the part of the microtype package that I'd wish to cancel somehow. In the MWE that I am including below I collect a couple of token contents to be typed as part of a footer in every odd page of a document. This footer is comprised of two boxes aligned horizontally, the first with its contents ragged left and a width given by that of a box with the string Authors: set in a typewriter face. The page placement where the boxes are to be typeset is specified in terms of a textblock environment (from the package textpos) to be aligned vertically with the left margin of the textblock. Finally, once the boxes have been typeset, there is a new paragraph comprised of a single line.

The MWE is as follows:

\documentclass[12pt]{memoir}

\usepackage{calc}
\usepackage[absolute]{textpos}
\usepackage{microtype}

\newtoks{\tokname}
\newtoks{\toktitle}
\newtoks{\toklatexed}
\toklatexed={Another paragraph}

\newcommand{\docauthors}[1]{\global\tokname={#1}}
\newcommand{\doctitle}[1]{\global\toktitle={#1}}

\newlength{\tagsboxlen}
\settowidth{\tagsboxlen}{\scriptsize\texttt{Authors:}}

\newcommand{\tagsbox}{%
   \parbox[t]{\tagsboxlen}{%
     \raggedleft
      Authors:\\
      Title:\\}}

\newcommand{\datatagsbox}{%
   \parbox[t]{\textwidth - \tagsboxlen - 1em}{%
     \the\tokname\\
     \the\toktitle\\}}

\newcommand{\footpaperdata}{%
   \setlength{\TPHorizModule}{1in + \oddsidemargin}
   \setlength{\TPVertModule}{1in + \textheight + \topmargin %
                             + \headheight + \headsep + \footskip  %
                             + 2\onelineskip}
  \begin{textblock}{10}[0,0](1,1)
     \scriptsize\ttfamily
     \noindent\tagsbox\hfill\datatagsbox
     \par\noindent\the\toklatexed
  \end{textblock}
}

\makeoddfoot{plain}{\footpaperdata}{}{}

\doctitle{This is the title}

\docauthors{This is the author's name}

\begin{document}

\pagestyle{plain}

Please, look at footer.

\end{document}

If I don't load the package microtype, the string Authors: is typeset aligned vertically with the textblock, but if I load it, the string is shifted a bit to the right, whereas the paragraph following those boxes is nonetheless aligned vertically with the textblock as described above.

Could anyone possibly explain what is going on here?

After reading egreg's answer I have thought of leaving to the consideration of anyone who may be interested an alternative that is based on his approach and that resorts to the package tabu. The entire MWE thus amended follows:

\documentclass[12pt]{memoir}

\usepackage{calc,tabu}
\usepackage[absolute]{textpos}
\usepackage{microtype}

\newtoks{\tokname}
\newtoks{\toktitle}
\newtoks{\toklatexed}
\toklatexed={Another paragraph}

\newcommand{\docauthors}[1]{\global\tokname={#1}}
\newcommand{\doctitle}[1]{\global\toktitle={#1}}

\newcommand{\paperdatatabu}{%
   \begin{tabu} spread0pt{@{}X[-1,r]X[-1,l]@{}}
      Authors:  &  \the\tokname\\
      Title:    &  \the\toktitle\\
   \end{tabu}
}


\newcommand{\footpaperdata}{%
   \setlength{\TPHorizModule}{1in + \oddsidemargin}
   \setlength{\TPVertModule}{1in + \textheight + \topmargin %
                             + \headheight + \headsep + \footskip  %
                             + 2\onelineskip}
  \begin{textblock}{10}[0,0](1,1)
     \scriptsize\ttfamily
     \paperdatatabu
     \par\noindent\the\toklatexed
  \end{textblock}
}

\makeoddfoot{plain}{\footpaperdata}{}{}

\doctitle{This is the title}

\docauthors{This is the author's name}

\begin{document}

\pagestyle{plain}

Please, look at footer.

\end{document}
share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You can inactivate locally the features of microtype:

\newcommand{\tagsbox}{%
   \parbox[t]{\tagsboxlen}{%
     \microtypesetup{activate=false}
     \raggedleft
      Authors:\\
      Title:\\}}

However, using parboxes and measuring them is not necessary:

\documentclass[12pt]{memoir}

\usepackage{calc}
\usepackage[absolute]{textpos}
\usepackage{microtype}

\newtoks{\tokname}
\newtoks{\toktitle}
\newtoks{\toklatexed}
\toklatexed={Another paragraph}

\newcommand{\docauthors}[1]{\global\tokname={#1}}
\newcommand{\doctitle}[1]{\global\toktitle={#1}}

\newcommand{\tagsbox}{%
   \begin{tabular}[t]{@{}l@{}}
      Authors:\\
      Title:
   \end{tabular}}

\newcommand{\datatagsbox}{%
   \begin{tabular}[t]{@{}l@{}}
     \the\tokname\\
     \the\toktitle
   \end{tabular}}

\newcommand{\footpaperdata}{%
   \setlength{\TPHorizModule}{1in + \oddsidemargin}
   \setlength{\TPVertModule}{1in + \textheight + \topmargin %
                             + \headheight + \headsep + \footskip  %
                             + 2\onelineskip}
  \begin{textblock}{10}[0,0](1,1)
     \scriptsize\ttfamily
     \noindent\tagsbox\hspace{1em}\datatagsbox
     \par\medskip\noindent\the\toklatexed
  \end{textblock}
}

\makeoddfoot{plain}{\footpaperdata}{}{}

\doctitle{This is the title}

\docauthors{This is the author's name}

\begin{document}

\pagestyle{plain}

Please, look at footer.

\end{document}

With tabular it's easier.

share|improve this answer
    
Dear egreg, thanks so much for your answer. I have edited my initial question in order to accommodate an alternative to your tabular-based approach. By the way, thanks are due also for the TeX-related material available in your website. –  Marcos Jul 6 '12 at 9:22
    
Don't understand why \microtypesetup{activate=false} does not Disable microtype for a portion of a document –  Peter Grill Jul 6 '12 at 17:49
    
@PeterGrill I don't know; but I won't tackle a question regarding \sfrac. ;-) –  egreg Jul 6 '12 at 17:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.