3

I'm using tabularx to have columns with evenly distributed width.

\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X} %centered and extended width column type

I have a column which always contains four digits, and in consequence of that the content of this column always has the same alignment in every row

\begin{document}
 \begin{center}
  \begin{tabularx}{0.75\textwidth}{*{7}{|Y}|}
   \hline
   N° & A & B & C & D & E & F \\ \hline
   5463 & some & useful & content & goes & right & here \\ \hline
   4353 & some & other & content & goes & here & too\\ \hline
  \end{tabularx}
 \end{center}
\end{document}

enter image description here

Sadly, every once in a while I need a footnote, and that screws the alignment up and makes it look bad.

\begin{document}
 \begin{center}
  \begin{tabularx}{0.75\textwidth}{*{7}{|Y}|}
   \hline
   N° & A & B & C & D & E & F \\ \hline
   5463 & some & useful & content & goes & right & here \\ \hline
   4353\footnote{A footnote is needed here} & some & other & content & goes & here & too\\ \hline
  \end{tabularx}
 \end{center}
\end{document}

enter image description here

Is there a way to center the four digit number, and have the footnote index appear on the right?

3

You have to hide the width of the footnote, which can be accomplished by setting the footnote mark in a zero width box.

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X} %centered and extended width column type

\newcommand{\hfootnote}[1]{%
  \makebox[0pt][l]{\footnotemark}%
  \footnotetext{#1}%
}

\setlength{\textheight}{2.5cm} % just to make a smaller picture

\begin{document}

\begin{center}
\begin{tabularx}{\textwidth}{*{7}{|Y}|}
\hline
N° & A & B & C & D & E & F \\ \hline
5463 & some & useful & content & goes & right & here \\ \hline
4353\hfootnote{abc} & some & other & content & goes & here & too\\ \hline
\end{tabularx}
\end{center}

\end{document}

enter image description here

3

try this:

\documentclass{article}
\usepackage{geometry}
\geometry{
paperwidth=18cm,
paperheight=4cm,
margin=0.5cm
}
\usepackage{tabularx}
\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

 %S[table-format=2.0]
 %>{\centering\arraybackslash}X
\begin{document}

  \begin{tabularx}{0.75\textwidth}{|S[table-format=4.0, table-column-width=.95cm] *{6}{|Y}|}
   \hline
   \multicolumn{1}{|Y|}{N°} & A & B & C & D & E & F \\ \hline
   5463 & some & useful & content & goes & right & here \\ \hline
   4353\footnote{A footnote is needed here} & some & other & content & goes & here & too\\ \hline
  \end{tabularx}

\end{document}

enter image description here

  • I think table-format=4.0 is more appropriate. – Sterry Jun 18 '17 at 9:02
  • Yes.. you are right! Just copied from older file and forgot to change it!... I will update – koleygr Jun 18 '17 at 9:04
  • Should I read tabularx' documentation on the S meaning and options, or is it a tabular thing? – Jeffrey Lebowski Jun 18 '17 at 11:11
  • 1
    No.. it is a siunitx thing... look here mirrors.rit.edu/CTAN/macros/latex/contrib/siunitx/siunitx.pdf at page 44 and forward – koleygr Jun 18 '17 at 11:43

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.