Como produzir esta tabela em látex com listas/itens inconsistentes?

Como produzir esta tabela em látex com listas/itens inconsistentes?

Quero produzir as duas primeiras linhas desta tabela de 5 colunas em LaTeX:

insira a descrição da imagem aqui

Como você pode ver, é um tipo especial de tabela onde vemos:

  • listas detalhadas dentro, mas de forma inconsistente, ou seja. coluna 4, todas as linhas possuem listas discriminadas dentro, as colunas 2,3 e 5 possuem listas discriminadas em algumas, mas não em todas as linhas, a coluna 1 não possui listas discriminadas.
  • o belo alinhamento da mesa
  • a aparência doce como aquela booktabspara que o pacote foi criado
  • é uma mesa compacta que não contém espaços desagradáveis
  • as listas têm marcadores quadrados

Código:

\documentclass{scrartcl}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{lscape}
\begin{document}
\begin{landscape}
  \thispagestyle{empty}           % hide page number
  \begin{table}
    \centering
    \setlength{\belowcaptionskip}{\abovecaptionskip}% Correct skip for caption on top
    \caption{Wide Itemized Mixed Table}
    \label{tab:wide-item-tbl}
      \begin{tabular}{lp{2in}p{2in}p{2in}p{2in}}
        \toprule
        \textbf{BSL} & \textbf{Agents} & \textbf{Practices} & \textbf{Primary barriers} & \textbf{Secondary barriers} \\
        \midrule
        1 & Not known to consistently cause diseases in healthy adults & standard microbiological practices & no primary barriers required, PPE & bench and sink required \\
        2 & - Agents associated with human diseases  - Routes of transmission include per-cutaneous injury, ingestion, mucous membrane exposure & BSL-1 practice plus: - limited access - Biohazard warning signs - ``Sharps'' precautions - Biosafety manual defining any needed waste decontamination or medical surveillance polices & Primary barriers: - BSCs or other physical containment devices used for all manipulations of agents that cause splashes or aerosols of infectious materials - PPE: Laboratory coats, gloves, face and eye protection, as needed & BSL-1 plus: - Autoclave available\\
        \bottomrule
      \end{tabular}%
  \end{table}
\end{landscape}
\end{document}

A resposta mais próxima que encontrei foiaqui, mas infelizmente esta resposta pressupõe que todas as linhas possuem uma lista detalhada e não algumas delas, portanto, por favor, preste atenção a este ponto antes de rotular esta postagem como duplicada.

Responder1

A resposta seria colocar a lista dentro de uma minipágina ou parbox, mas isso não é muito divertido. Aqui está outra solução para enumitemusar as teclas beforee aftere o comando \tablistcommand: Use tabitemizequando você tiver uma célula apenas com uma lista e limpe a beforechave com o texto anterior à lista. As linhas estão alinhadas corretamente.

\documentclass[landscape]{scrartcl}
\usepackage{booktabs,array,enumitem,ragged2e}

\newcommand{\tablistcommand}{%
  \leavevmode\par\vspace{-\baselineskip}%
}

\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{%
  leftmargin = *               ,
  label      = \textbullet     ,
  nosep                        ,
  before     = \tablistcommand ,
  after      = \tablistcommand
}

\begin{document}
\thispagestyle{empty}
\begin{table}
  \centering
  \caption{Wide Itemized Mixed Table}
  \label{tab:wide-item-tbl}
  \begin{tabular}{@{}l*{4}{>{\RaggedRight}p{2in}}@{}}
    \toprule
    \textbf{BSL} & \textbf{Agents} & \textbf{Practices}
    & \textbf{Primary barriers} & \textbf{Secondary barriers} \\
    \midrule
    1 & Not known to consistently cause diseases in healthy adults
      & standard microbiological practices
      & \begin{tabitemize}
        \item no primary barriers required,
        \item  PPE
        \end{tabitemize}
      & bench and sink required \tabularnewline
    2 & \begin{tabitemize}
        \item Agents associated with human diseases
        \item Routes of transmission include per-cutaneous injury,
          ingestion, mucous membrane exposure
        \end{tabitemize}
      & BSL-1 practice plus:
        \begin{tabitemize}[before=]
        \item limited access
        \item Biohazard warning signs
        \item ``Sharps'' precautions
        \item Biosafety manual defining any needed waste
          decontamination or medical surveillance polices
        \end{tabitemize}
      & Primary barriers:
        \begin{tabitemize}[before=]
        \item BSCs or other physical containment devices used for all
          manipulations of agents that cause splashes or aerosols of
          infectious materials
        \item PPE: Laboratory coats, gloves, face and eye protection,
          as needed
        \end{tabitemize}
      & BSL-1 plus:
        \begin{tabitemize}[before=]
        \item Autoclave available
        \end{tabitemize}\tabularnewline
    \bottomrule
  \end{tabular}
\end{table}
\end{document}

insira a descrição da imagem aqui


EDITAR

Realmente depende do seu caso de uso, mas provavelmente eu faria uma tabela como esta em um documento. Se você tiver uma mesa muito longa, faria mais sentido girá-la.

\documentclass[a4paper]{article}
\usepackage{%
  booktabs,tabularx,enumitem,ragged2e,%
  caption,lipsum,showframe,geometry}

\captionsetup[table]{%
  format        = plain        ,
  font          = footnotesize ,
  labelfont     = bf           , 
  justification = centerlast   , 
  labelsep      = period       ,
  position      = top          ,
  aboveskip     = 5pt          ,
  belowskip     = 0pt
}

\newcommand{\tablistcommand}{%
  \leavevmode\par\vspace{-\baselineskip}%
}

\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{%
  leftmargin = *               ,
  label      = \textbullet     ,
  nosep                        ,
  before     = \tablistcommand ,
  after      = \tablistcommand
}

\begin{document}
\lipsum[1]

\begin{table}[!h]
  \caption{Wide Itemized Mixed Table}
  \label{tab:wide-item-tbl}
  \footnotesize
  \begin{tabularx}{\linewidth}{@{}l*{4}{>{\RaggedRight}X}@{}}
    \toprule
    \scriptsize BSL & \scriptsize Agents & \scriptsize Practices
    & \scriptsize Primary barriers & \scriptsize Secondary barriers \\
    \midrule
    1 & Not known to consistently cause diseases in healthy adults
      & standard microbiological practices
      & \begin{tabitemize}
        \item no primary barriers required,
        \item  PPE
        \end{tabitemize}
      & bench and sink required \tabularnewline\addlinespace
    2 & \begin{tabitemize}
        \item Agents associated with human diseases
        \item Routes of transmission include per-cutaneous injury,
          ingestion, mucous membrane exposure
        \end{tabitemize}
      & BSL-1 practice plus:
        \begin{tabitemize}[before=]
        \item limited access
        \item Biohazard warning signs
        \item ``Sharps'' precautions
        \item Biosafety manual defining any needed waste
          decontamination or medical surveillance polices
        \end{tabitemize}
      & Primary barriers:
        \begin{tabitemize}[before=]
        \item BSCs or other physical containment devices used for all
          manipulations of agents that cause splashes or aerosols of
          infectious materials
        \item PPE: Laboratory coats, gloves, face and eye protection,
          as needed
        \end{tabitemize}
      & BSL-1 plus:
        \begin{tabitemize}[before=]
        \item Autoclave available
        \end{tabitemize}\tabularnewline
    \bottomrule
  \end{tabularx}
\end{table}

\lipsum[1]
\end{document}

insira a descrição da imagem aqui

Responder2

Aqui está umenumitemversão:

insira a descrição da imagem aqui

Eu defini uma tableitemsvariante do itemizeambiente e usei-a dentro da sua mesa. Observe o hack desajeitado usado \vspacepara listas que não possuem cabeçalho. Sem isso, há uma linha vazia na lista.

Código

    \documentclass{scrartcl}
    \usepackage{graphicx}
    \usepackage{booktabs}
    \usepackage{enumitem}
    \usepackage{lscape}
    \newlist{tableitems}{itemize}{1}
    \usepackage{mathabx}% for \sqbullet
    \setlist[tableitems]{nosep,
                         topsep=0pt,
                         partopsep=0pt,
                         leftmargin=1em,
                         label=$\sqbullet$
    }
    \begin{document}
    \begin{landscape}
      \thispagestyle{empty}           % hide page number
      \begin{table}
        \centering
        \setlength{\belowcaptionskip}{\abovecaptionskip}% Correct skip for caption on top
        \caption{Wide Itemized Mixed Table}
        \label{tab:wide-item-tbl}
          \begin{tabular}{lp{2in}p{2in}p{2in}p{2in}}
            \toprule
            \textbf{BSL} & \textbf{Agents} & \textbf{Practices} & \textbf{Primary barriers} & \textbf{Secondary barriers} \\
            \midrule
            1 & Not known to consistently cause diseases in healthy adults
              & standard microbiological practices
              &\vspace{-1em}
              \begin{tableitems}
                 \item No primary barriers required
                 \item PPE
              \end{tableitems}
              & bench and sink required
            \\\midrule
            2 & \vspace{-1ex}
            \begin{tableitems}
             \item  Agents associated with human diseases
             \item Routes of transmission include per-cutaneous injury,
                    ingestion, mucous membrane exposure
            \end{tableitems}
            & BSL-1 practice plus:
            \begin{tableitems}
               \item limited access
               \item Biohazard warning signs
               \item ``Sharps'' precautions
               \item Biosafety manual defining any needed waste
               decontamination or medical surveillance polices
            \end{tableitems}
             & Primary barriers:
            \begin{tableitems}
               \item BSCs or other physical containment devices used for all
                   manipulations of agents that cause splashes or aerosols of
                   infectious materials
               \item PPE: Laboratory coats, gloves, face and eye protection, as needed
            \end{tableitems}
             & BSL-1 plus:
            \begin{tableitems}
               \item Autoclave available
            \end{tableitems}
            \\
            \bottomrule
          \end{tabular}%
      \end{table}
    \end{landscape}
    \end{document}

Responder3

Não é perfeito, mas veja se é útil:

\documentclass{scrartcl}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\bfseries\sffamily}
\newcommand{\textblacksquare}{\rule[.2ex]{0.8ex}{0.8ex}}
    \usepackage{paralist}
    \usepackage{ragged2e}
    \usepackage[margin=1in,showframe]{geometry}
    \usepackage{rotating}

\begin{document}
    \thispagestyle{empty}           % hide page number
\begin{sidewaystable}
    \centering
    \small\sffamily
    \caption{Wide Itemized Mixed Table}
    \label{tab:wide-item-tbl}
  \begin{tabularx}{\textheight}{c*{4}{>{\RaggedRight\arraybackslash}X}}
    \toprule
\thead{BSL} 
    &   \thead{Agents} 
        &   \thead{Practices} 
            &   \thead{Primary barriers} 
                &   \thead{Secondary barriers}  \\
    \midrule
1   &   Not known to consistently cause diseases in healthy adults 
        &   standard microbiological practices
            &   \vspace{-2ex}
                    \begin{compactitem}[\textblacksquare]
                \item   No primary barriers required,
                \item   PPE
                    \end{compactitem}
                &   Laboratora bench and sink required \\
    \midrule
2   &   \vspace{-2ex}
            \begin{compactitem}[\textblacksquare]
        \item Agents associated with human diseases
        \item Routes of transmission include per-cutaneous injury, ingestion, mucous membrane exposure
            \end{compactitem}
        &   BSL-1 practice plus:
                \begin{compactitem}[\textblacksquare]
            \item   limited access
            \item   Biohazard warning signs
            \item   ``Sharps'' precautions
            \item   Biosafety manual defining any needed waste decontamination or medical surveillance polices
                \end{compactitem}
            &   Primary barriers:
                    \begin{compactitem}[\textblacksquare]
                \item   BSCs or other physical containment devices used for all manipulations of agents that cause splashes or aerosols of infectious materials
                \item   PPE: Laboratory coats, gloves, face and eye protection, as needed
                    \end{compactitem}
                &   BSL-1 plus:
                        \begin{compactitem}[\textblacksquare]
                    \item Autoclave available
                        \end{compactitem}   \\
    \bottomrule
    \end{tabularx}
\end{sidewaystable}
\end{document}

Em vez de landscapeusar sidewaystablefrom package rotatinge for lists dentro da tabela compactitemfrom package paralist. Resultado semelhante você pode obter com enumitempackage (com o qual estou menos familiarizado). Para tabela eu prefiro usar tabularxpackage onde para formatação eu uso \RaggedRightfrom ragged2epackage.

insira a descrição da imagem aqui

Termo aditivo: Parece que a combinação das três respostas dará a melhor solução :-). Então eu combino o seguinte

  • $\sqbullet$from package mathabxpackage conforme proposto por Andrew em sua resposta
  • a maneira como Arash Esbati usa o pacote enumitemem sua resposta
  • tabularxe alinhamento de texto para cabeçalhos de colunas, sidewaystableconforme proponho em minha resposta.RaggedRightmakecell

Com isso o código "comum" passa a ser:

\documentclass{scrartcl}

\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\bfseries\sffamily}
\usepackage{ragged2e}
\usepackage[a4paper,margin=1in,showframe]{geometry}
\usepackage{rotating}
%    
\usepackage{mathabx}% for \sqbullet
\usepackage{enumitem}% for nice list
\newcommand{\tablistcommand}{% <-- for eliminating vertical space
                             %     before and after itemize
            \leavevmode\par\vspace{-\baselineskip}
                            }
\newlist{tableitems}{itemize}{1}% <-- defined new list
\setlist[tableitems]{nosep,     % <-- new list setup
                     topsep     = 0pt               ,
                     partopsep  = 0pt               ,
                     leftmargin = *                 ,
                     label      = $\sqbullet$       ,
                     before     = \tablistcommand   ,
                     after      = \tablistcommand
                     }

    \begin{document}
      \thispagestyle{empty}
%---------------------------------------------------------------%
\begin{sidewaystable}[h]%table
    \centering
    \small\sffamily
\caption{Wide Itemized Mixed Table}
    \label{tab:wide-item-tbl}
\begin{tabularx}{\textwidth}{c*{4}{>{\RaggedRight\arraybackslash}X}}
    \toprule
\thead{BSL}
    &   \thead{Agents}
        &   \thead{Practices}
            &   \thead{Primary barriers}
                &   \thead{Secondary barriers}  \\
    \midrule
1   &   Not known to consistently cause diseases in healthy adults
        &   standard microbiological practices
            &   \begin{tableitems}
                \item   No primary barriers required,
                \item   PPE
                \end{tableitems}
                &   Laboratory bench and sink required \\
    \midrule
2   &   \begin{tableitems}
        \item Agents associated with human diseases
        \item Routes of transmission include per-cutaneous injury, ingestion, mucous membrane exposure
        \end{tableitems}
        &   BSL-1 practice plus:
            \begin{tableitems}[before=]% <-- nullifying before skip
            \item   limited access
            \item   Biohazard warning signs
            \item   ``Sharps'' precautions
            \item   Biosafety manual defining any needed waste decontamination or medical surveillance polices
            \end{tableitems}
            &   Primary barriers:
                \begin{tableitems}[before=]% <-- nullifying before skip
                \item   BSCs or other physical containment devices used for all manipulations of agents that cause splashes or aerosols of infectious materials
                \item   PPE: Laboratory coats, gloves, face and eye protection, as needed
                \end{tableitems}
                &   BSL-1 plus:
                    \begin{tableitems}[before=]% <-- nullifying before skip
                    \item Autoclave available
                    \end{tableitems}   \\
    \bottomrule
\end{tabularx}
\end{sidewaystable}%table
%---------------------------------------------------------------%
    \end{document}

Com isso a tabela fica como pode ser vista abaixo:

insira a descrição da imagem aqui

informação relacionada