2

I have a table like below which works without any error in my main.tex. I would like to add to a vertical line and maybe need some touch about the lines. Many thanks in advance.my table

\documentclass[11pt,authoryear,sort&compress]{report}
    \usepackage[pdftex]{graphicx}
    \usepackage{caption,tabularx,booktabs}
    
    \begin{document}
    \begin{table}[ht]
        \footnotesize
        %\scriptsize
        \centering 
        \begin{tabularx}{1\textwidth}{R*{6}{C}}
            %\begin{tabular}{ccc|cccc}
            \toprule
            & \multicolumn{2}{c}{Access} & \multicolumn{4}{c}{Type} \\
            \cline{2-7} \cline{3-7} \cline{4-7} \cline{5-7} \cline{6-7} \cline{7-7} 
            \toprule
            & 0 & 1 & Formal & Informal & Both & No Loan \\ 
            %\midrule
            \cline{2-7} \cline{3-7} \cline{4-7} \cline{5-7} \cline{6-7} \cline{7-7}  \\ %\midrule
            HR \textit{\text{(Urban = 1)}} & 18.72\% & 81.28\% &  &  &  & \\
            Education \textit{\text{(Above highschool = 1)}}  & 94.99\% & 5.01\% &  &  &  & \\
            CCP/no.CCP \textit{\text{(CCP= 1)}}  & 90.22\% & 9.78\%  &  &  &  & \\
            Gender \textit{\text{(Male = 1)}}   &  17.33\% & 82.67 &  &  &  & \\
            \bottomrule
            %\end{tabular}
        \end{tabularx}
        \caption{Chi test} 
        \label{tab:Chi.test}
    \end{table}
    \end{document}
2
  • 3
    Vertical lines should not be used with the booktabs rules and in your out commented example using ccc|ccc the | will contain holes. This is by design. Generally vertical lines does not help with the understanding of a data table. You can try *{2}{C} | *{4}{C} but it will look bad. I normally emulate lines by adding space between certain columns
    – daleif
    May 28 at 12:17
  • 2
    How did you define the R and C column types?
    – Bernard
    May 28 at 12:53
1

Hope the combination of framed and float will help you to meet the requirement, here is the MWE

\documentclass[11pt,authoryear,sort&compress]{report}
\usepackage{amsmath}
    \usepackage[pdftex]{graphicx}
    \usepackage{caption,tabularx,booktabs}
\usepackage{float,framed}
    
    \begin{document}
\begin{leftbar}
    \begin{table}[H]
        \footnotesize
        %\scriptsize
        \centering 
        \begin{tabularx}{1\textwidth}{r*{6}{c}}
            %\begin{tabular}{ccc|cccc}
            \toprule
            & \multicolumn{2}{c}{Access} & \multicolumn{4}{c}{Type} \\
            \cline{2-7} \cline{3-7} \cline{4-7} \cline{5-7} \cline{6-7} \cline{7-7} 
            \toprule
            & 0 & 1 & Formal & Informal & Both & No Loan \\ 
            %\midrule
            \cline{2-7} \cline{3-7} \cline{4-7} \cline{5-7} \cline{6-7} \cline{7-7}  \\ %\midrule
            HR \textit{\text{(Urban = 1)}} & 18.72\% & 81.28\% &  &  &  & \\
            Education \textit{\text{(Above highschool = 1)}}  & 94.99\% & 5.01\% &  &  &  & \\
            CCP/no.CCP \textit{\text{(CCP= 1)}}  & 90.22\% & 9.78\%  &  &  &  & \\
            Gender \textit{\text{(Male = 1)}}   &  17.33\% & 82.67 &  &  &  & \\
            \bottomrule
            %\end{tabular}
        \end{tabularx}
        \caption{Chi test} 
        \label{tab:Chi.test}
    \end{table}
\end{leftbar}
    \end{document}
1
  • hello thank you very much for the response, but could you click on the photo that I posted *{2}{C} | *{4}{C} works fine but it is an interrupted line I would like to insert a constant line between 1 and Formal. May 29 at 13:33

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.