0

This question might be silly, it's easy to look at and could've been answered after looking at the Internet, but still, I came here for help. This question look like this:

I want to create a table using LaTeX. The table looks like this:

(LOGINtest.png)

I was able to manage make a table, but it is not what I envisioned. It looks like this:

(LOGINtest.png)

The code I used looks like this:

\documentclass[a4paper,twocolumn]{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow,booktabs}
\setlength\parindent{0pt}
\begin{document}

\begin{tabular}{|c|c|c|c|}
\hline
\multirow{2}{*}{USERNAME} & \multirow{2}{*}{PASSWORD} & Did the user denied access to the app when the user inputted wrong username or password? \\

                         &                          &  YES                    & NO \\
                    \hline
papad@gmail.com          & 7221456                  &                         & \\ 
                     \hline
idislikeyou@gmail.com    & password                 &                         &  \\
                     \hline
devs@gmail.com           & 12A2ZAQR                 &                         & \\
                     \hline
devs@gmail.com           & password                 &                         & \\
                     \hline

\end{tabular}

\end{document}

My question is:

How can we make a table using LaTeX that looks like the first picture above?

And I wonder what is the best book for LaTeX to be read...

1 Answers1

1

Is this enough?

\documentclass[a4paper,twocolumn]{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow,booktabs}
\usepackage{amssymb}
\usepackage{array}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\setlength\parindent{0pt}
\begin{document}

    \begin{center}
        \begin{tabular}{@{}*{2}{c}*{2}{C{.5\linewidth}}@{}}
        \toprule
        \multirow{2}{*}{USERNAME} & \multirow{2}{*}{PASSWORD} & \multicolumn{2}{C{\linewidth}}{Did the user denied access to the app when the user inputted wrong username or password?} \\ \cmidrule{3-4}
                                  &                           &    YES     &                                                      NO                                                       \\ \midrule
             papad@gmail.com      &          7221456          & \checkmark &                                                                                                               \\ 
          idislikeyou@gmail.com   &         password          & \checkmark &                                                  \checkmark                                                   \\ 
             devs@gmail.com       &         12A2ZAQR          & \checkmark &                                                                                                               \\ 
             devs@gmail.com       &         password          &            &                                                  \checkmark                                                   \\ \bottomrule
    \end{tabular}
    \end{center}

\end{document}

enter image description here


Edit

Code revision to fit the needs

\documentclass[a4paper,twocolumn]{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{array}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\setlength\parindent{0pt}
\begin{document}

    \begin{center}
        \begin{tabular}{*{2}{|c}*{2}{|C{.5\linewidth}}|}
            \hline
            \multirow{3}{*}{USERNAME} & \multirow{3}{*}{PASSWORD} & \multicolumn{2}{C{\linewidth}|}{Did the user denied access to the app when the user inputted wrong username or password?} \\ \cline{3-4}
            &                           &    YES     &                                                      NO                                                       \\ \hline
            papad@gmail.com      &          7221456          & \checkmark &                                                                                                               \\ \hline
            idislikeyou@gmail.com   &         password          & \checkmark &                                                  \checkmark                                                   \\ \hline
            devs@gmail.com       &         12A2ZAQR          & \checkmark &                                                                                                               \\ \hline
            devs@gmail.com       &         password          &            &                                                  \checkmark                                                   \\ \hline
        \end{tabular}
    \end{center}

\end{document}

enter image description here

NBur
  • 4,326
  • 10
  • 27