0

I am trying to replicate this table in LaTeX.

enter image description here

This is the code I am using:

    \begin{table}[H]
    \begin{minipage}{1\textwidth}
     \caption[Cronograma]{Cronograma \raggedright}
        \label{tabla:cronograma}
        \begin{center}
%   %   %   %   -------
    \begin{tabularx}{\textwidth}{@{}|p{7.5cm}|X|X|X|X|X|X|}
    \toprule
           \centering{\textbf{ACTIVIDADES}} & \textbf{MES 1}   & \textbf{MES 2}    & \textbf{MES 3}   & \textbf{MES 4}   & \textbf{MES 5}   & \textbf{MES 6}\\ \midrule
           Recopilar información de la historia de producción del campo.    & \cellcolor{gray} &  &  &  &  & \\
           %\hrule
           Diseñar sistema de bombeo mecánico para cada pozo.               & \cellcolor{gray} & \cellcolor{gray}  &  &  &  & \\
           %\hrule
           Modelar el sistema de producción de los pozos del campo provincia y validar la consistencia del modelo obtenido. & &\cellcolor{gray} & \cellcolor{gray} & & &  \\
           %\hrule
           Correr las simulaciones (pozo a pozo y a al campo) y análisis de resultados. & & \cellcolor{gray} & \cellcolor{gray} & & &\\ 
           %\hrule
           Comparar el comportamiento de las curvas de desempeño de producción de cada pozo. & & & \cellcolor{gray} & \cellcolor{gray} & & \\
           %\hrule
           Sugerir los pozos candidatos al cambio del sistema de levantamiento artificial de Gas lift a Bombeo mecánico. & & & & & \cellcolor{gray} & \\
           %\hrule
           Realizar un análisis financiero a los cambios sugeridos. & & & & & & \cellcolor{gray} \\
           %\hrule
           Estructurar el proyecto. &  & & & & & \cellcolor{gray} \\
           %\hrule
           Redacción del libro & & & & & & \cellcolor{gray} \\  \bottomrule
            \end{tabularx}
        \end{center}
    \end{minipage}
    \end{table}

Yet I am struggling with the rows height, since I want them to be even. I already tried inserting the source table as a figure, but it appears in the figures list (wrong). And also I want to learn how to achieve what I want.

Table in LaTeX

Thanks in advance!

2

it is not clear (to me) what is your problem. i guessing, that you like to do the following table:

enter image description here

it design very depends on your document layout, but about it you not provide any information.

the code for above table is:

\documentclass{article}
\usepackage{geometry}

\usepackage[table]{xcolor}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand\ch{\rule[-2.5em]{0pt}{3.5em}}


\begin{document}
    \begin{table}[htb]
    \caption[Cronograma]{Cronograma \raggedright}
        \label{tabla:cronograma}
        \centering
        \small
    \begin{tabularx}{\linewidth}{|p{70mm}|*{6}{C|} @{}c@{} }
    \Xhline{1pt}
\thead{ACTIVIDADES} & \thead{MES\\ 1} & \thead{MES\\ 2} & \thead{MES\\ 3}
                    & \thead{MES\\ 4} & \thead{MES\\ 5} & \thead{MES\\ 6}   &       \\
    \Xhline{0.5pt}
Recopilar información de la historia de producción del campo.
                    & \cellcolor{gray!30} &  &  &  &  &                     & \ch   \\
    \hline
Diseñar sistema de bombeo mecánico para cada pozo.
                    & \cellcolor{gray!30} & \cellcolor{gray!30}  &  &  &  & & \ch   \\
    \hline
Modelar el sistema de producción de los pozos del campo provincia y validar la consistencia del modelo obtenido.
                    & & \cellcolor{gray!30} & \cellcolor{gray!30} & & &     & \ch   \\
    \hline
Correr las simulaciones (pozo a pozo y a al campo) y análisis de resultados.
                    & & \cellcolor{gray!30} & \cellcolor{gray!30} & & &     & \ch   \\
    \hline
Comparar el comportamiento de las curvas de desempeño de producción de cada pozo.
                    & & & \cellcolor{gray!30} & \cellcolor{gray!30} & &    & \ch   \\
    \hline
Sugerir los pozos candidatos al cambio del sistema de levantamiento artificial de Gas lift a Bombeo mecánico.
                    & & & & & \cellcolor{gray!30} &                         & \ch   \\
    \hline
Realizar un análisis financiero a los cambios sugeridos.
                    & & & & & & \cellcolor{gray!30}                         & \ch   \\
    \hline
Estructurar el proyecto.
                    &  & & & & & \cellcolor{gray!30}                        & \ch   \\
    \hline
Redacción del libro & & & & & & \cellcolor{gray!30}                         & \ch   \\
    \Xhline{1pt}
    \end{tabularx}
    \end{table}
\end{document}

i will add some explanation to my code after your confirmation, that my guessing is correct.

edit:

  • first i remove minipage and center environment. instead of the latter is used \centering command, which not introduce additional vertical space around table as environment center do
  • introduced is new column with zero width for rules, which make all rows equal high. these rules are defined by command \ch (see mwe above)
  • since your document layout is not know (it is important for table design therefore is standard request to provide complete small document and not only fragment of code) and your table were not fit in default width of text in article document class, i define own document preamble, which layout is determined by default values of the geometry package options.
  • for column headers is used thead macro from the makecell package
  • for thicker horizontal lines are used Xhline{...}˙ defined in the makecell package
  • for better aligning of text in cells in the first column, the font size in table is reduced to \small.
  • for possible further improvement of table you need to provide more information about your document and desired table layout.
  • Hello @Zarko, this is just what I want to do! – Edwin Oct 24 '18 at 18:11
  • @Edwin, good to hear this. i edit ma answer as i promised. if answer fullfil your expectation on the best way, you should consider to accept it (by clicking on check mark at the top left side of my answer) :-) – Zarko Oct 24 '18 at 18:40
0

Here is a possible solution: I removed the rules from booktabs, which introduce a vertical padding around its rules and is not designed for vertical rules. I replaced them with the variable width rules from the small boldline package, and \extrarowheight.

\documentclass[spanish]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel} 

\usepackage[table, svgnames]{xcolor}
\usepackage[showframe]{geometry} 
\usepackage{graphicx,rotating}
\usepackage{float}%for table decimals number
\usepackage[export]{adjustbox}

\usepackage{tabularx, ragged2e, caption, boldline}
\colorlet{mygray}{LightSlateGray!60}
\newcommand{\nl}{\newline\mbox{}}

\begin{document}

\begin{table}[H]
\setlength{\tabcolsep}{3pt}
\setlength{\extrarowheight}{3pt}
 \caption[Cronograma]{Cronograma \raggedright}
    \label{tabla:cronograma}\centering
% % % % -------
\begin{tabularx}{\linewidth}{@{}|>{\RaggedRight\arraybackslash}X|*{6}{c|}}
\hlineB{2}
       \centering{\textbf{ACTIVIDADES}} & \textbf{MES 1} & \textbf{MES 2} & \textbf{MES 3} & \textbf{MES 4} & \textbf{MES 5} & \textbf{MES 6}\\ 
       \hlineB{1.5}
       Recopilar información de la historia de producción del campo. \nl & \cellcolor{mygray} & & & & & \\[2ex]
       %\hrule
       Diseñar sistema de bombeo mecánico para cada pozo. \nl & \cellcolor{mygray} & \cellcolor{mygray} & & & & \\[2ex]
       %\hrule
       Modelar el sistema de producción de los pozos del campo provincia y validar la consistencia del modelo obtenido. & &\cellcolor{mygray} & \cellcolor{mygray} & & & \\[1ex]
       %\hrule
       Correr las simulaciones (pozo a pozo y a al campo) y análisis de resultados. \nl & & \cellcolor{mygray} & \cellcolor{mygray} & & &\\[1ex]
       %\hrule
       Comparar el comportamiento de las curvas de desempeño de producción de cada pozo. & & & \cellcolor{mygray} & \cellcolor{mygray} & & \\[1ex]
       %\hrule
       Sugerir los pozos candidatos al cambio del sistema de levantamiento artificial de Gas lift a Bombeo mecánico. & & & & & \cellcolor{mygray} & \\[1ex]
       %\hrule
       Realizar un análisis financiero a los cambios sugeridos. \nl & & & & & & \cellcolor{mygray} \\[1ex]
       %\hrule
       Estructurar el proyecto. \nl \nl& & & & & & \cellcolor{mygray} \\[1ex]
       %\hrule
       Redacción del libro \nl \nl& & & & & & \cellcolor{mygray} \\ 
       \hlineB{2}
        \end{tabularx}
\end{table}

\end{document}

enter image description here

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.