2

I am using the memoir package with TeXMaker on Windows 7. I would like to create a table (unsing tabularx) in which I explain the symbols that I will be using throughout my document. The symbols themselves are imported from MnSymbol. I do not use MnSymbol math characters throughout, but just import the few symbols I need in the preamble.

Now, for some reason, using these MnSymbol characters in a tabularx environment introduces arbitrary vertical space in my main document like so:

Examplme of misaligned last column, with symbols.

Why? What throws me is that, when writing a MWE for this thread, the misalignment disappeared! Here's a snapshot of the MWE.

And suddenly, the misalignment disappears.

I have not modified the definition of the table environment in my main memoir document. I have tried replacing the MnSymbol macros I've created with their 'plain' commands, which did not resolve the issue.

Could someone help?

Minimal Working Example

\documentclass[a4paper, 11pt, onecolumn, twoside]{memoir}

\usepackage{multirow}
\usepackage{tabularx}

% Import symbols from MnSymbol:
\DeclareFontFamily{U} {MnSymbolC}{}
\DeclareFontShape{U}{MnSymbolC}{m}{n}{
  <-6> MnSymbolC5
  <6-7> MnSymbolC6
  <7-8> MnSymbolC7
  <8-9> MnSymbolC8
  <9-10> MnSymbolC9
  <10-12> MnSymbolC10
  <12-> MnSymbolC12}{}
\DeclareFontShape{U}{MnSymbolC}{b}{n}{
  <-6> MnSymbolC-Bold5
  <6-7> MnSymbolC-Bold6
  <7-8> MnSymbolC-Bold7
  <8-9> MnSymbolC-Bold8
  <9-10> MnSymbolC-Bold9
  <10-12> MnSymbolC-Bold10
  <12-> MnSymbolC-Bold12}{}

\DeclareSymbolFont{MnSyC} {U} {MnSymbolC}{m}{n}

\DeclareMathSymbol{\medstar}{\mathbin}{MnSyC}{130}
\DeclareMathSymbol{\medlozenge}{\mathbin}{MnSyC}{197}
\DeclareMathSymbol{\medtriangleup}{\mathbin}{MnSyC}{81}

\begin{document}

\begin{table}
    \centering
    \begin{tabularx}{\textwidth}{c*4{>{\centering\arraybackslash}X}} 
     Letter & Caption & Number & Symbol\\
     \multicolumn{4}{c}{\rule[-.3\baselineskip]{0pt}{\baselineskip}}\\
    A & first line & $1.00$ & $\medstar$ \\
    B & second line & $2.00$ & $\medlozenge$ \\
    C & third line & $3.00$ & $\medtriangleup$ \\
    \multicolumn{4}{c}{\hrulefill}
    \end{tabularx}
    \caption{Here's a basic table.}
\end{table}

\end{document}
0

Your example shows no misalignment, as testified by this code, where I add \showbase to the first cell in order to mark the baseline:

\documentclass[a4paper, 11pt, onecolumn, twoside]{memoir}

\usepackage{tabularx}
\usepackage{xcolor}

\newcommand{\showbase}{\makebox[0pt][l]{\vrule height 0pt depth 0.1pt width \textwidth}}

% Import symbols from MnSymbol:
\DeclareFontFamily{U} {MnSymbolC}{}
\DeclareFontShape{U}{MnSymbolC}{m}{n}{
  <-6> MnSymbolC5
  <6-7> MnSymbolC6
  <7-8> MnSymbolC7
  <8-9> MnSymbolC8
  <9-10> MnSymbolC9
  <10-12> MnSymbolC10
  <12-> MnSymbolC12}{}
\DeclareFontShape{U}{MnSymbolC}{b}{n}{
  <-6> MnSymbolC-Bold5
  <6-7> MnSymbolC-Bold6
  <7-8> MnSymbolC-Bold7
  <8-9> MnSymbolC-Bold8
  <9-10> MnSymbolC-Bold9
  <10-12> MnSymbolC-Bold10
  <12-> MnSymbolC-Bold12}{}

\DeclareSymbolFont{MnSyC} {U} {MnSymbolC}{m}{n}

\DeclareMathSymbol{\medstar}{\mathbin}{MnSyC}{130}
\DeclareMathSymbol{\medlozenge}{\mathbin}{MnSyC}{197}
\DeclareMathSymbol{\medtriangleup}{\mathbin}{MnSyC}{81}

\begin{document}

\begin{table}
    \centering
    \begin{tabularx}{\textwidth}{>{\showbase}c*4{>{\centering\arraybackslash}X}} 
     Letter & Caption & Number & Symbol\\
     \multicolumn{4}{c}{\rule[-.3\baselineskip]{0pt}{\baselineskip}}\\
    A & first line & $1.00$ & $\medstar$ \\
    B & second line & $2.00$ & $\medlozenge$ \\
    C & third line & $3.00$ & $\medtriangleup$ \\
    \multicolumn{4}{c}{\hrulefill}
    \end{tabularx}
    \caption{Here's a basic table.}
\end{table}

\end{document}

enter image description here

On the other hand, if I change the first table row into

    A & first line & $1.00$ & \color{blue}$\medstar$ \\

I get

enter image description here

which indeed shows the issue. It is precisely caused by \color{blue} starting the text. If the input is the correct

\textcolor{blue}{$\medstar$}

the problem would not appear.

So the issue is not linked to using symbols imported from MnSymbol, but just to improper usage of \color.

Note that your tricks for making a rule or leaving space in the table are wrong.

Here's a working code:

\begin{table}
\centering

\begin{tabularx}{\textwidth}{c*4{>{\centering\arraybackslash}X}}
Letter & Caption & Number & Symbol\\[1ex]
A & first line & $1.00$ & \textcolor{blue}{$\medstar$} \\
B & second line & $2.00$ & \textcolor{green}{$\medlozenge$} \\
C & third line & $3.00$ & \textcolor{red}{$\medtriangleup$} \\
\hline
\end{tabularx}

\caption{Here's a basic table.}
\end{table}

I suggest using booktabs anyway.

enter image description here

  • Ah, that's instructive. Thanks, the difference between color and textcolor completely eluded me. Do you have an idea why, not changing my previous usage of color, I managed to align my entries just by adding the \renewcommand{\tabularxcolumn}[1]{m{#1}} in the preamble? (Also, for reference, I did switch to booktabs. Thanks for the recommendation.) – A. Debugne Apr 23 '17 at 12:22
0

Your table "construction" is quite unusual. And MnSymbol is not source of your problem.

Its not clear what you like to achieve with \multicolumn{4}{c}{\rule[-.3\baselineskip]{0pt}{\baselineskip}}\\ . Instead this I will rader use some of rules from package booktabs, for example \addlinespace for increasinf space between rows, \midrul fro line between column headers and rest of columns and bottomrule for line on bottom of the table:

\documentclass[a4paper, 11pt, onecolumn, twoside]{memoir}

\usepackage{multirow}
\usepackage{booktabs} % added 'booktabs', removed 'tabularx' since it is provided by memoir

% Import symbols from MnSymbol:
\DeclareFontFamily{U} {MnSymbolC}{}
\DeclareFontShape{U}{MnSymbolC}{m}{n}{
  <-6> MnSymbolC5
  <6-7> MnSymbolC6
  <7-8> MnSymbolC7
  <8-9> MnSymbolC8
  <9-10> MnSymbolC9
  <10-12> MnSymbolC10
  <12-> MnSymbolC12}{}
\DeclareFontShape{U}{MnSymbolC}{b}{n}{
  <-6> MnSymbolC-Bold5
  <6-7> MnSymbolC-Bold6
  <7-8> MnSymbolC-Bold7
  <8-9> MnSymbolC-Bold8
  <9-10> MnSymbolC-Bold9
  <10-12> MnSymbolC-Bold10
  <12-> MnSymbolC-Bold12}{}

\DeclareSymbolFont{MnSyC} {U} {MnSymbolC}{m}{n}

\DeclareMathSymbol{\medstar}{\mathbin}{MnSyC}{130}
\DeclareMathSymbol{\medlozenge}{\mathbin}{MnSyC}{197}
\DeclareMathSymbol{\medtriangleup}{\mathbin}{MnSyC}{81}

\begin{document}

\begin{table}
    \centering
    \begin{tabularx}{\textwidth}{c*4{>{\centering\arraybackslash}X}}
     Letter & Caption & Number & Symbol\\
%     \addlinespace   % it is not clear, if you like to have more vertical space
    \midrule          % or line as I selected here
    A & first line & $1.00$ & $\medstar$ \\
    B & second line & $2.00$ & $\medlozenge$ \\
    C & third line & $3.00$ & $\medtriangleup$ \\
    \bottomrule
    \end{tabularx}
    \caption{Here's a basic table.}
\end{table}

\end{document}

enter image description here

  • Thanks for your suggestions, Zarko. I did resort to using booktabs for introducing vertical space and lines, rather than butchering some piece of code together. However, that did not solve my problem. For some reason, my main memoir file still 'staggers' my right column. – A. Debugne Mar 23 '17 at 11:55
0

Somewhat shamefully, adding \renewcommand{\tabularxcolumn}[1]{m{#1}} in the preamble combined with Zarko's answer solved my problem. Hopes this'll help others too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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