0

Hi everyone I'm trying do write a table but I have some problem. Could you help me in order to fix it?

enter image description here

This is my code:

 \documentclass[a4paper,12pt]{article}[12pt] 

 \usepackage{amsbsy}
 \usepackage{amsmath}
 \usepackage{pbox}
 \usepackage{fancyhdr}
 \usepackage{cancel}
 \usepackage{tabularx} 
 \usepackage{booktabs} 
 \usepackage{multirow} 
 \usepackage{longtable} 


 \usepackage{textcomp} 

 \linespread{1.5}


 \usepackage{multicol}

 \usepackage{textcomp} 

 \usepackage[a4paper,top=1.0cm,bottom=1.0cm,left=1.0cm,right=1.0cm]{geometry}




 \usepackage{pifont}




 \usepackage{bbding}
 \usepackage{mathtools}% superior to amsmath



 \newcommand{\cuthere}{%
 \noindent
 \raisebox{-2.8pt}[0pt][0.75\baselineskip]{\small\ding{34}}
 \unskip{\tiny\dotfill}
 }




 \newcommand{\makenonemptybox}[2]{%
 \par\nobreak\vspace{\ht\strutbox}\noindent
 \fbox{%
 \parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
 \hrule width \hsize height 0pt
 #2
 }%
 }%
 \par\vspace{\ht\strutbox}
 }




 \begin{document}



 \begin{tabular}{|c|c|c|c|c|l|}
 \hline
 S.  & P.  coll    & Let sta   & L.C.O.    & L.C.V.             \\
 \hline
 S $2.51$ $ [\text{t}] $  & A & $ 2.7 $ $ 1.9 $  & $ 6.69 $      & $                     8°13'30''$ $ 8°14'30''$          \\
 \hline
 & B & $ 3.1 $ $ 2.1 $  & $ 6.32 $      & $ 5°03'40''$ $ 5°04'50''$                \\
 \hline   

 \end{tabular}




 \end{document}
1

You should use multirow and multicolumn. Note that I dropped everything from the preamble which was unimportant regarding your problem.

\documentclass{article}
\usepackage{multirow} 
\usepackage{multicol}
\usepackage{textcomp} 
\usepackage{mathtools}
\begin{document}

\begin{tabular}{|c|c|c|c|c|l|}
\hline
\multirow{2}{*}{S.}& P.& Let & \multicolumn{2}{|c|}{L.C.}\\\cline{4-5}
&coll&sta&L.C.O.    & L.C.V.  \\
\hline
\multirow{4}{*}{S 2.51[\text{t}]}  & \multirow{2}{*}{A} &2.7& \multirow{2}{*}{6.69}&$8^\circ13'30''$\\
&&1.9&&$8^\circ14'30''$\\
\cline{2-5}
& \multirow{2}{*}{A}&3.1&\multirow{2}{*}{6.32}&$5^\circ03'40''$               \\
&&2.1&&$5^\circ04'50''$ \\
\hline   
\end{tabular}
\end{document}

enter image description here

  • Thanks a lot! I would like to write P. coll and Let sta like my picture, but if I write "P. \\ coll" and "Let \\ sta" it doesn't work. Thanks a lot. – ryuk Jan 20 at 21:44
  • 1
    @ryuk I corrected according to your wishes ;) – bmv Jan 20 at 21:46
  • Thanks a lot...last question...How can I write "S \\ 2.51 [t]" (S and 2.51 [t] written like P. coll - two different line but same cell). I'm trying to understand how it works. Thanks – ryuk Jan 20 at 22:07
  • You can use \cline to add a partial horizontal line. E.g. \cline{2-5} draws horizontal line only in columns 2-5. You should create two cells for S and 2.51 [t] without drawing a line between them. – bmv Jan 20 at 22:16
  • Could you please write me please the exat code in order to write "S \\ 2.51 [t]" (S and 2.51 [t] written like P. coll - two different line but same cell). I don't understand. Thanks ;) – ryuk Jan 24 at 21:57

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.