GeneralAlignment of Figure References in Table

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

Alignment of Figure References in Table

Post by pallav »

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.

Code: Select all

\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
untitled.JPG (28.93 KiB) Viewed 4462 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Re: Alignment of Figure References in Table

Post by pallav »

Please someone help/reply for my quarry. Thanking you. Pallav
User avatar
Stefan Kottwitz
Site Admin
Posts: 10344
Joined: Mon Mar 10, 2008 9:44 pm

Alignment of Figure References in Table

Post by Stefan Kottwitz »

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
table-alignment.png (4.7 KiB) Viewed 4350 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
LaTeX.org admin
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

Re: Alignment of Figure References in Table

Post by pallav »

Thank you. I shall check in another pc and return back to you.
Post Reply