LaTeX forum ⇒ GeneralAlignment of Figure References in Table

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

Alignment of Figure References in Table

Postby pallav » Fri May 17, 2013 8:56 am

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.

  1. \documentclass[10pt]{article}
  2. \usepackage{lmodern}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[babel=true]{microtype}
  5. \usepackage{mathpazo}
  6. \usepackage{moreverb,amsmath,amssymb,amsthm,mathptmx,enumerate,multicol,stmaryrd,subfig,float,tabu}
  7. \usepackage{caption}
  8. \usepackage[demo]{graphicx}
  9. \usepackage{booktabs,multirow,array}
  10. \usepackage[table]{xcolor}
  11. \usepackage{hyperref}
  12. \hypersetup{colorlinks = true,linkcolor = blue, anchorcolor = blue, citecolor = blue, pdfstartpage=1, filecolor = red,urlcolor = red}
  13. \usepackage[compact]{titlesec}
  14. \definecolor{lightgray}{gray}{0.9}
  15.  
  16. \begin{document}
  17. \begin{table}[H]
  18. \caption{Nature of the....}
  19. \label{tab:6}
  20. \centering
  21. \scriptsize\addtolength{\tabcolsep}{-2pt}
  22. \colorbox{lightgray}{%
  23. \begin{tabu} to .95\linewidth{X[1.2l]X[2.5l]X[1l]X[1l]X[2.5l]}
  24. \toprule[.5pt]
  25. {\bf bbbb} & {\bf pppp} & & {\bf Figure}& {\bf gggg}\\
  26. \midrule[1pt]
  27. {$m$} & {$m=0.3$} & & {\ref{Fig:Bif_Diag_disease} \subref{fig:subfig1_DP}} &{1(a)} \\
  28. \midrule[.5pt]
  29. & {$m< 0.3$} & {} & {\ref{Fig:Bif_Diag_disease} \subref{fig:subfig2_DP}} &{1(b)} \\
  30. \midrule[.5pt]
  31. & {$m \leq 0.4$} & {Yes} & {\ref{Fig:Bif_Diag_disease}\subref{fig:subfig1_DP}} &{1(a)} \\
  32. \midrule[.5pt]
  33. & {$m\geq 0.4$} & {No} & {\ref{Fig:Bif_Diag_disease}\subref{fig:subfig2_DP}} &{1(b)} \\
  34. \bottomrule[.5pt]
  35. \end{tabu}
  36. }
  37. \end{table}
  38. \begin{figure}[htbp]
  39. \centering
  40. \subfloat[\label{fig:subfig1_DP}]{
  41. \includegraphics[height=3cm,width=3cm]{Bif_Diag_m.eps}
  42. }
  43. \subfloat[\label{fig:subfig2_DP}]{
  44. \includegraphics[height=3cm,width=3cm]{Bif_Diag_alpha.eps}
  45. }
  46. \caption{(Color online) (a) ..........}
  47. \label{Fig:Bif_Diag_disease}
  48. \end{figure}
  49. \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 1890 times

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby pallav » Fri Jul 05, 2013 12:50 pm

Please someone help/reply for my quarry. Thanking you. Pallav

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Jul 05, 2013 2:33 pm

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 1778 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
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby pallav » Fri Jul 05, 2013 7:35 pm

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

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests