如何在表格环境中插入子项目符号?

如何在表格环境中插入子项目符号?

我在使用 TeXMaker 在表格中制作项目符号时遇到了困难。

这是我正在处理的表格的一个示例。

这或多或少就是它的样子 目的表

-我希望能够引入子项目符号,但我不知道如何(如果可能的话,同时保持$\RHD$(或右侧菱形;见上图)符号(英文):

-尝试逐项介绍这些子项目,但没有成功

-即使是一个简单的 itemize 也无法编译由于某种原因,我收到了许多错误消息;

这是我需要帮助的地方

-我想理解为什么 itemize 在下面不起作用我如何使用 RHD 符号引入子项目符号

代码示例

临时位(尝试在这里实现 Mico 的答案。)

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

\usepackage{times}
\linespread{1.5}
\usepackage{geometry}
 \geometry{
 a4paper,
 left=1in,
 right=1in,
 top=1in,
 bottom=1in
 }
\usepackage{setspace} % allows you to change spacing inside document - for e.g for tables, relevant for tables
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb} % AMS symbols
\usepackage{wasysym} % more symbols - \RHD (arrow)
\usepackage{pifont} % for dingbat symbols 
\usepackage{longtable}
\usepackage{booktabs}% Pretty tables
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{dcolumn}
  \newcolumntype{d}[1]{D{.}{.}{#1}} 
\usepackage{sectsty} % want sigle spacing in subheadings and headings 
\allsectionsfont{\singlespacing}

\usepackage{lipsum}
\usepackage{float}

% To get landscape in between pages
\usepackage{lscape}
\usepackage{pdflscape}
\usepackage{parskip} % allows space between paragraphs
\setlength{\parindent}{3em} % sets indentation of paragraph
\setlength{\parskip}{0em} % allows space between paragraphs 
\usepackage{indentfirst}

\usepackage[british]{babel}
\usepackage{enumitem, ragged2e,array}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}

% 'btr': short for 'black triangle right'
\newlist{btr}{itemize}{2} % setup for 2 list levels
% elements common to both level-l and level-2 lists:
\setlist[btr]{nosep, left=0pt,
              before=\begin{minipage}{\linewidth},
              after =\end{minipage}}
% level-1 and level-2 items differ (only) in size of \blacktriangleright symbol:
\setlist[btr,1]{label=$\scriptstyle\blacktriangleright$}
\setlist[btr,2]{label=$\vcenter{\hbox{$\scriptscriptstyle\blacktriangleright$}}$}

\begin{document}
\begin{landscape}
\begin{spacing}{1}
\begin{longtable}{p{1.5in}p{1in}p{2in}p{1.5in}p{2.5in}}

\toprule
Study & Country & Characteristic/Component & Methodology & Findings\\ 
\midrule
\endfirsthead
\toprule
Study & Country & Characteristic/Component & Methodology & Findings\\ 
\midrule
\endhead % all the lines above this will be repeated on every page

\bottomrule % puts bottomrule @ end of table on every page
\endfoot

\bottomrule % puts bottomrule @ end of final page 
\endlastfoot

sample study name
&
sample country
&
\begin{tabular}{p{2in}}
$\RHD$ sample intervention;\\
$\RHD$ sample methodology.
\end{tabular}
&
\begin{tabular{@{}p{\linewidth}@{}}
%\begin{tabular}{p{1.5in}}
\begin{btr}
\item sample methodologies
    \begin{btr}
    \item hello
    \end{btr}
\end{btr}
\end{tabular}
&
\begin{tabular}{p{2.5in}}
$\RHD$ sample findings;\\
$\RHD$ finding 2;\\
$\RHD$ finding 3;\\
\end{tabular}\\
\midrule
\addlinespace
\end{longtable}
\end{spacing}
\end{landscape}
\end{document}

(我知道这包含了一个很长的软件包列表;这是与其他人合作的项目,我删除了尽可能多的多余软件包...可能还有更多不必要的软件包,但不确定是哪些。此外,如果它有帮助,原始表格跨越 10 多页)

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

\usepackage{times}
\linespread{1.5}
\usepackage{geometry}
 \geometry{
 a4paper,
 left=1in,
 right=1in,
 top=1in,
 bottom=1in
 }
\usepackage{setspace} % allows you to change spacing inside document - for e.g for tables, relevant for tables
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb} % AMS symbols
\usepackage{wasysym} % more symbols - \RHD (arrow)
\usepackage{pifont} % for dingbat symbols 
\usepackage{longtable}
\usepackage{booktabs}% Pretty tables
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{dcolumn}
  \newcolumntype{d}[1]{D{.}{.}{#1}} 
\usepackage{sectsty} % want sigle spacing in subheadings and headings 
\allsectionsfont{\singlespacing}

\usepackage{lipsum}
\usepackage{float}

% To get landscape in between pages
\usepackage{lscape}
\usepackage{pdflscape}
\usepackage{parskip} % allows space between paragraphs
\setlength{\parindent}{3em} % sets indentation of paragraph
\setlength{\parskip}{0em} % allows space between paragraphs 
\usepackage{indentfirst}

\usepackage[british]{babel}
\usepackage{enumitem}

\begin{document}
\begin{landscape}
\begin{spacing}{1}
\begin{longtable}{p{1.5in}p{1in}p{2in}p{1.5in}p{2.5in}}

\toprule
Study & Country & Characteristic/Component & Methodology & Findings\\ 
\midrule
\endfirsthead
\toprule
Study & Country & Characteristic/Component & Methodology & Findings\\ 
\midrule
\endhead % all the lines above this will be repeated on every page

\bottomrule % puts bottomrule @ end of table on every page
\endfoot

\bottomrule % puts bottomrule @ end of final page 
\endlastfoot

sample study name
&
sample country
&
\begin{tabular}{p{2in}}
$\RHD$ sample intervention;\\
$\RHD$ sample methodology.
\end{tabular}
&
\begin{tabular}{p{1.5in}}
\begin{itemize}
\item sample methodologies; \\
\end{itemize}
\end{tabular}
&
\begin{tabular}{p{2.5in}}
$\RHD$ sample findings;\\
$\RHD$ finding 2;\\
$\RHD$ finding 3;\\
\end{tabular}\\
\midrule
\addlinespace

\end{longtable}
\end{spacing}
\end{landscape}
\end{document}

表格的一部分理想情况下看起来像其中之一(箭头代表$\RHD$;在单词中找不到它)):

v1 在此处输入图片描述

感谢您花时间阅读本文。非常感谢您的帮助和指导。

答案1

(根据 OP 的要求,通过二级“btr”类似项目的环境增强了答案。)

我建议您不要设置大量单独的表格环境并手动创建逐项列表,而是使用enumitem包机制(如下所示)来创建两级定制的逐项列表环境。

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{longtable,booktabs}
\usepackage{enumitem,ragged2e,array} % new
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\usepackage{amssymb} % for "\blacktriangleright" macro

% 'btr': short for 'black triangle right'
\newlist{btr}{itemize}{2} % setup for 2 list levels
% elements common to both level-l and level-2 lists:
\setlist[btr]{nosep, left=0pt,
              before=\begin{minipage}{\linewidth},
              after =\end{minipage}}
% level-1 and level-2 items differ (only) in size of \blacktriangleright symbol:
\setlist[btr,1]{label=$\scriptstyle\blacktriangleright$}
\setlist[btr,2]{label=$\vcenter{\hbox{$\scriptscriptstyle\blacktriangleright$}}$}


\begin{document}
\begin{longtable}{@{} P{0.85in} P{0.95in} P{1.5in} *{2}{P{1.25in}} @{}}
\toprule
Study & Country & Characteristic\slash Component & Methodology & Findings\\ 
\midrule
\endhead

\bottomrule
\endlastfoot

sample study name&
sample country&
\begin{btr}
\item sample intervention
\item sample methodology
\end{btr} &
\begin{btr}
\item sample methodology
  \begin{btr}
  \item Hello
  \item Byebye
  \end{btr}
\item sample methodology
\item sample methodology
\end{btr} &
\begin{btr}
\item sample findings;
\item finding 2;\\
\item finding 3;\\
\end{btr}
\end{longtable}

\end{document}

附录解决 OP 的最新后续问题。我解释事情的能力最近肯定已经大大下降了,因为你发布的新代码几乎做到了完全相反我认为我已经推荐过的内容。

  • btr如果在类型列中使用定制的列表式环境p,则完全没有必要btr材料装入单列tabular包装器中。因此,请更换

     \begin{tabular{@{}p{\linewidth}@{}}
     %\begin{tabular}{p{1.5in}}
     \begin{btr}
     \item sample methodologies
         \begin{btr}
         \item hello
         \end{btr}
     \end{btr}
     \end{tabular}
    

    \begin{btr}
    \item sample methodologies
        \begin{btr}
        \item hello
        \end{btr}
    \end{btr}
  • 想法我告诉你要做的事情是:如果出于某种原因,你不是想要使用定制的列表式环境,那么一定要使用单列tabular环境来创建看起来像是由列表类型环境生成的东西。我按照你的问题,“是否有可能在单独的表格环境中实现你的解决方案?”我以为这意味着你正在寻找一个选择接近btr。我错了吗?

相关内容