## LaTeX forum ⇒ General ⇒ Alignment of Figure References in Table

LaTeX specific issues not fitting into one of the other forums of this category.
pallav
Posts: 162
Joined: Wed Nov 12, 2008 5:53 pm

### Alignment of Figure References in Table

I am facing a problem when I am referring a figure in a table. I have used the package tabu, as I like it most user friendly. Also I want to color (grey) the background of the table. But after referring the figs in table, I getting an alignment problem. Please help me to solve my problem.

\documentclass[10pt]{article}\usepackage{lmodern}\usepackage[T1]{fontenc}\usepackage[babel=true]{microtype}\usepackage{mathpazo}\usepackage{moreverb,amsmath,amssymb,amsthm,mathptmx,enumerate,multicol,stmaryrd,subfig,float,tabu}\usepackage{caption}\usepackage[demo]{graphicx}\usepackage{booktabs,multirow,array}\usepackage[table]{xcolor}\usepackage{hyperref}\hypersetup{colorlinks = true,linkcolor = blue, anchorcolor = blue, citecolor = blue, pdfstartpage=1, filecolor = red,urlcolor = red}\usepackage[compact]{titlesec}\definecolor{lightgray}{gray}{0.9} \begin{document}   \begin{table}[H]     \caption{Nature of the....}     \label{tab:6}     \centering     \scriptsize\addtolength{\tabcolsep}{-2pt}     \colorbox{lightgray}{%       \begin{tabu} to .95\linewidth{X[1.2l]X[2.5l]X[1l]X[1l]X[2.5l]}         \toprule[.5pt]         {\bf bbbb} & {\bf pppp} &  & {\bf Figure}& {\bf gggg}\\         \midrule[1pt]         {$m$} & {$m=0.3$} &  & {\ref{Fig:Bif_Diag_disease} \subref{fig:subfig1_DP}} &{1(a)}  \\          \midrule[.5pt]         & {$m< 0.3$} & {} &  {\ref{Fig:Bif_Diag_disease} \subref{fig:subfig2_DP}} &{1(b)}  \\          \midrule[.5pt]         & {$m \leq 0.4$} &   {Yes} & {\ref{Fig:Bif_Diag_disease}\subref{fig:subfig1_DP}} &{1(a)}  \\          \midrule[.5pt]         & {$m\geq 0.4$} &  {No} & {\ref{Fig:Bif_Diag_disease}\subref{fig:subfig2_DP}} &{1(b)}  \\          \bottomrule[.5pt]       \end{tabu}     }   \end{table}   \begin{figure}[htbp]     \centering     \subfloat[\label{fig:subfig1_DP}]{       \includegraphics[height=3cm,width=3cm]{Bif_Diag_m.eps}     }     \subfloat[\label{fig:subfig2_DP}]{       \includegraphics[height=3cm,width=3cm]{Bif_Diag_alpha.eps}     }     \caption{(Color online) (a) ..........}     \label{Fig:Bif_Diag_disease}   \end{figure}\end{document}

I suspect that the problem may occurs due to the use of \usepackage[table]{xcolor}, but it is required in order to color the background of the table.
Attachments
untitled.JPG (28.93 KiB) Viewed 2283 times

Tags:

pallav
Posts: 162
Joined: Wed Nov 12, 2008 5:53 pm

Stefan Kottwitz
Posts: 8598
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
You made a very good minimal example, so of course I tested it now that I saw it.

I got a correct alignment:

table-alignment.png (4.7 KiB) Viewed 2171 times

Click above your example code on "Open in writeLaTeX" to see it there, it's fine as well. So I guess it's a version issue, perhaps update involved packages or make the final compilation on a different computer if you don't want to change your working environment for now.

Stefan