1

1st case ("microtype"): \textsc yielding no effect, but rest of that left columnn is nicely aligned (notice the dates are "flush"):

enter image description here

\PassOptionsToPackage{svgnames}{xcolor}

\documentclass[a4paper]{article}

\usepackage{gitinfo}

\usepackage[none]{hyphenat}

\usepackage{fontspec}

\pdfprotrudechars=2
\pdfadjustspacing=2
\newfontfeature{Microtype}{protrusion=default;expansion=default;}
\directlua{fonts.protrusions.setups.default.factor=.5}

\setmainfont[Microtype, Numbers={OldStyle, Proportional}, Ligatures=TeX]{Calibri}
 \newfontface\NoMicrotype[Numbers={OldStyle}, Ligatures=TeX]{Calibri}



\usepackage{graphicx}

%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table
\usepackage{calc}
%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table

% \usepackage{booktabs}
% \usepackage{array}

%%%-------------------------------------

\usepackage{colortbl}
 \newlength{\mycustomlength}


\settowidth\mycustomlength{blaaaaaaaaaaaaaaaa}



%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[framemethod=TikZ]{mdframed}    
\usepackage{tabularx}


%%% tex.SX (97180) - How to get column alignment in tabularx?
\usepackage{array}
\newcolumntype{Z}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}



\begin{document}

%\begin{tabularx}{\textwidth}{@{} >{\NoMicrotype}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
\begin{tabularx}{\textwidth}{@{}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
%%%

\strut\rlap{\textsc{\color{blue}Some Subtitle}}%
  \raisebox{-.7mm}
  {%
    \noindent\tikz\shade[left color=blue, right color=white, middle color=white] 
    (0,0) rectangle (\textwidth,-0.02);
  } 
  \\ 
%%%%%%
blaaaaaaaaa & blaaaaaaaaaaa.
\\
& blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\\
01/1803\,–\,04/1901 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\
12/1815\,–\,07/1899 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\

\end{tabularx}

\end{document}

2nd case ("no microtype"): \textsc works, but rest of that columnn is not nicely aligned (dates are not "flush"):

enter image description here

\PassOptionsToPackage{svgnames}{xcolor}

\documentclass[a4paper]{article}

\usepackage{gitinfo}

\usepackage[none]{hyphenat}

\usepackage{fontspec}

\pdfprotrudechars=2
\pdfadjustspacing=2
\newfontfeature{Microtype}{protrusion=default;expansion=default;}
\directlua{fonts.protrusions.setups.default.factor=.5}

\setmainfont[Microtype, Numbers={OldStyle, Proportional}, Ligatures=TeX]{Calibri}
 \newfontface\NoMicrotype[Numbers={OldStyle}, Ligatures=TeX]{Calibri}



\usepackage{graphicx}

%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table
\usepackage{calc}
%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table

% \usepackage{booktabs}
% \usepackage{array}

%%%-------------------------------------

\usepackage{colortbl}
 \newlength{\mycustomlength}


\settowidth\mycustomlength{blaaaaaaaaaaaaaaaa}



%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[framemethod=TikZ]{mdframed}    
\usepackage{tabularx}


%%% tex.SX (97180) - How to get column alignment in tabularx?
\usepackage{array}
\newcolumntype{Z}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}



\begin{document}

%\begin{tabularx}{\textwidth}{@{} >{\NoMicrotype}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
\begin{tabularx}{\textwidth}{@{}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
%%%

\strut\rlap{\textsc{\color{blue}Some Subtitle}}%
  \raisebox{-.7mm}
  {%
    \noindent\tikz\shade[left color=blue, right color=white, middle color=white] 
    (0,0) rectangle (\textwidth,-0.02);
  } 
  \\ 
%%%%%%
blaaaaaaaaa & blaaaaaaaaaaa.
\\
& blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\\
01/1803\,–\,04/1901 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\
12/1815\,–\,07/1899 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\

\end{tabularx}

\end{document}

Any way to override the column's \NoMicrotype (which seems responsible for defecting \textsc) setting for the "Some Subtitle" line (row, cell, whatever) ?

0

1 Answer 1

4

It is unrelated to microtype or tabularx, you specified proportional figures so the digits have different widths, just omit that and you do not need to load two fonts.

enter image description here

\PassOptionsToPackage{svgnames}{xcolor}

\documentclass[a4paper]{article}

\usepackage{gitinfo}

\usepackage[none]{hyphenat}

\usepackage{fontspec}

\protrudechars=2
\adjustspacing=2
\newfontfeature{Microtype}{protrusion=default;expansion=default;}
\directlua{fonts.protrusions.setups.default.factor=.5}

\setmainfont[Microtype, Numbers={OldStyle}]{Calibri}




\usepackage{graphicx}

%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table
\usepackage{calc}
%%%http://tex.stackexchange.com/questions/79414/how-to-align-the-following-in-a-table

% \usepackage{booktabs}
% \usepackage{array}

%%%-------------------------------------

\usepackage{colortbl}
 \newlength{\mycustomlength}


\settowidth\mycustomlength{blaaaaaaaaaaaaaaaa}



%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[framemethod=TikZ]{mdframed}    
\usepackage{tabularx}


%%% tex.SX (97180) - How to get column alignment in tabularx?
\usepackage{array}
\newcolumntype{Z}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}



\begin{document}

%\begin{tabularx}{\textwidth}{@{} >{\NoMicrotype}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
\begin{tabularx}{\textwidth}{@{}*{1}{p{\mycustomlength}}*{1}{X}@{}} % sub-headings modification
%%%

\strut\rlap{\textsc{\color{blue}Some Subtitle}}%
  \raisebox{-.7mm}
  {%
    \noindent\tikz\shade[left color=blue, right color=white, middle color=white] 
    (0,0) rectangle (\textwidth,-0.02);
  } 
  \\ 
%%%%%%
blaaaaaaaaa & blaaaaaaaaaaa.
\\
& blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\\
01/1803\,–\,04/1901 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\
12/1815\,–\,07/1899 & blaaaaa blaaaablaaaaa blaaaablaaaaa blaaaa
\\

\end{tabularx}

\end{document}

Note this page has unusably over full boxes but I left that for now:

ABD: EveryShipout initializing macros
Overfull \hbox (263.07129pt too wide) in paragraph at lines 75--75
[]||[][]| 

Overfull \hbox (15.0pt too wide) in paragraph at lines 75--76
3
  • almost there: chucking out "proportional" did the trick, but a different table with \begin{tabularx}{\textwidth}{@{}p{\mycustomlength}Xc@{}} ended up misaligned. Any quick-n-dirty trick to keep "proportional" for this other table? Commented Jun 28, 2017 at 21:28
  • the alignment is like "justified" and the words spread out with a linebreak. I'd like to keep them nicely together like in the text of this comment. Commented Jun 28, 2017 at 21:49
  • for that offending line I now just "glued" the words together with a tilde ~ which is satisfactory. Commented Jun 28, 2017 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .