I'm not sure why polyglossia
adds extra space between the graphic and caption, maybe a bug. You can just use \centercaption
at the beginning of the wrapfigure
environment to prevent the extra space it produces.
BTW, wrapfig
package's wrapfigure
environment has several optional parameters. The first one is the number of lines it vertically occupies. For your example:
\begin{wrapfigure}[8]{r}{2cm}
\centercaption
\rule{2cm}{2cm}
\caption{test}
\end{wrapfigure}
See the manual of wrapfig
for more options and decriptions.
Instead of trying to pad the non-ruled columns with a coloured \cmidrule
attempt, draw a horizontal line (of the specified colour) across the entire table first, and then skip back (upward) and redraw your \cmidrule
s. This "skipping" is provided by
\specialrule{<wd>}{<above>}{<below>}
which draws a rule of width <wd>
across the table width, leaving a gap of <above>
above and <below>
below the rule. For your specific instance,
\specialrule{\heavyrulewidth}{0pt}{-\heavyrulewidth}
does the trick. It's the colour changes that causes the "line breaks" in the table, pushing each subsequent \cmidrule
down by the width of the previous \cmidrule
. Since you need to change the colour for this specific rule, it's best to define your own new rule command:
\newcommand*{\rulefiller}{%
\arrayrulecolor[gray]{0.8}% change to cell colour
\specialrule{\heavyrulewidth}{0pt}{-\heavyrulewidth}% "invisible" rule
\arrayrulecolor{black}% revert to regular line colour
}
Here's your complete MWE (with some small code modifications):
\documentclass[11pt]{article}
\usepackage{longtable}% http://ctan.org/pkg/longtable
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{colortbl}% http://ctan.org/pkg/colortbl
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\setlength{\extrarowheight}{0.25ex}
\newcolumntype{L}{>{\columncolor[gray]{0.8}}l}
\newcolumntype{C}{>{\columncolor[gray]{0.8}}c}
\newcolumntype{R}{>{\columncolor[gray]{0.8}}r}
\newcommand*{\rulefiller}{%
\arrayrulecolor[gray]{0.8}% change to cell colour
\specialrule{\heavyrulewidth}{0pt}{-\heavyrulewidth}% "invisible" rule
\arrayrulecolor{black}% revert to regular line colour
}
\begin{document}
{\sffamily
\begin{longtable}{LLLLL}
& \multicolumn{3}{@{}L}{\small \tablename\ \thetable\ - demonstration of odd vertical alignment with arrayrulecolor} & \\%
& \multicolumn{3}{@{}L}{\small case 1: the line below is a toprule} & \\%
\toprule
& \multicolumn{3}{@{}L}{\small case 2: the line below is a cmidrule that spans the middle 3 columns. Note the whitespace!} & \\%
& \multicolumn{3}{@{}L}{\small The challenge: hide the widespace giving the appearance of a spacing around a longtable.} & \\%
\rulefiller\cmidrule[\heavyrulewidth]{2-4}
& \multicolumn{3}{@{}L}{\small case 3: the line below is 3 cmidrules, 1 each for the first and last columns and 1 for the middle} & \\%
& \multicolumn{3}{@{}L}{\small note how the cmidrules align vertically ... perfect!} & \\%
\cmidrule[\heavyrulewidth]{1-1}\cmidrule[\heavyrulewidth]{2-4}\cmidrule[\heavyrulewidth]{5-5}
& \multicolumn{3}{@{}L}{\small case 4: Now, lets try recoloring the first and last cmidrules} & \\%
& \multicolumn{3}{@{}L}{\small how do I eliminate the odd vertical alignments?} & \\%
\rulefiller\cmidrule[\heavyrulewidth]{2-4}
\endfirsthead
& Arizona State University & & ASU & \\
& Baylor University & & BAYLOR & \\
& Boston University & 164988 & BU & \\
& Brown University & 217156 & BROWN & \\
& California Institute of Technology & 110404 & CALTECH & \\
& Carnegie Mellon University & 211440 & CMU & \\
& Case Western Reserve University & 201645 & CASE & \\
& Columbia University & 190150 & COLUMBIA & \\
& Cornell University & 190415 & CORNELL & \\
& Yale University & 130794 & YALE & %
\label{tab:schools}
\end{longtable}
}
\end{document}
This is a side-note, but your table doesn't fit within the margins of the page, causing an "Overfull hbox" warning.
Best Answer
Just like Simon Dispa said, all I needed to do was remove the double backslash from the line where I use the \cmidrule commands: