일관되지 않은 목록/항목이 있는 라텍스에서 이 테이블을 생성하는 방법은 무엇입니까?

일관되지 않은 목록/항목이 있는 라텍스에서 이 테이블을 생성하는 방법은 무엇입니까?

LaTeX에서 이 5열 테이블의 처음 두 행을 생성하고 싶습니다.

여기에 이미지 설명을 입력하세요

보시다시피 이것은 특별한 유형의 테이블입니다.

  • 항목별 목록이 내부에 있지만 일관성이 없습니다. 4열의 모든 행에는 항목별 목록이 있고, 2,3, 5열에는 일부 행에 항목별 목록이 있지만 모든 행은 그렇지 않으며, 1열에는 항목별 목록이 전혀 없습니다.
  • 테이블의 정렬이 좋다
  • 캔디아이 같은 외모는 무슨 booktabs패키지를 위해 만들어졌나
  • 불편한 공간이 없는 콤팩트한 테이블입니다
  • 목록에는 사각형 글머리 기호가 있습니다.

암호:

\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}

내가 찾은 가장 가까운 답변은 다음과 같습니다.여기, 하지만 안타깝게도 이 답변에서는 모든 행에 항목별 목록이 있고 그 중 일부는 없다고 가정합니다. 따라서 이 게시물을 중복으로 표시하기 전에 이 점에 주의해 주시기 바랍니다.

답변1

대답은 목록을 미니페이지나 파박스 안에 넣는 것이지만, 그건 별로 재미가 없습니다. 다음은 및 키와 명령을 enumitem사용 하는 또 다른 솔루션입니다. 목록만 있는 셀이 있을 때 사용 하고 목록 앞에 텍스트가 있는 키를 지웁니다. 선이 올바르게 정렬되었습니다.beforeafter\tablistcommandtabitemizebefore

\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}

여기에 이미지 설명을 입력하세요


편집하다

실제로 사용 사례에 따라 다르지만 아마도 문서에 이와 같은 표를 만들 것입니다. 테이블이 매우 길다면 회전시키는 것이 더 합리적일 것입니다.

\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}

여기에 이미지 설명을 입력하세요

답변2

여기는열거 항목버전:

여기에 이미지 설명을 입력하세요

tableitems환경 의 변형을 정의하고 itemize이를 테이블 내부에서 사용했습니다. \vspace헤더가 없는 목록에 대한 부적절한 해킹을 참고하세요 . 이것이 없으면 목록에 대한 빈 줄이 있습니다.

암호

    \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}

답변3

완벽하지는 않지만 유용한지 확인하세요.

\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}

대신에 from package 와 package 의 테이블 내부 목록을 landscape사용했습니다 . 비슷한 결과를 패키지로 얻을 수 있습니다 (저는 익숙하지 않습니다). 테이블의 경우 형식을 지정하기 위해 패키지 에서 사용하는 패키지를 사용합니다 .sidewaystablerotatingcompactitemparalistenumitemtabularx\RaggedRightragged2e

여기에 이미지 설명을 입력하세요

부록: 세 가지 답변을 모두 조합하면 최상의 솔루션이 될 것 같습니다 :-). 그래서 나는 다음을 결합합니다

  • $\sqbullet$mathabxAndrew가 답변에서 제안한 패키지 패키지에서
  • enumitemArash Esbati가 답변에서 패키지를 사용하는 방식
  • tabularx, sidewaystable그리고 내 대답에서 제안한 대로 열 제목에 대한 RaggedRight텍스트 정렬입니다 .makecell

이를 통해 "공통" 코드는 다음과 같습니다.

\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}

이를 통해 테이블은 아래에서 볼 수 있는 것처럼 보입니다.

여기에 이미지 설명을 입력하세요

관련 정보