3

I am having difficulty making bulleted points in tables using TeXMaker.

This is a sample of the table I am working on.

This is moreorless what it looks like intended table

-I want to be able to introduce sub-bullets but I don't know how (if possible, while maintaining the $\RHD$ (or right hand diamond; see figure above) symbol);

-Tried itemize to introduce these sub-bullets unsuccessfully;

-Even a simple itemize does not compile for some reason and I get a number of error messages;

Here is where I would like help:

-I would like to understand why itemize does not work below and how I might introduce sub-bullets using the RHD symbol;

Sample of the code

Temporary bit (trying to implement Mico's answer here.)

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

(I know that this contains a very long list of packages; this is a joint project with someone else and I removed as many excess packages as I could ... there may be more nonessential packages but was not sure which these were. Also, in case it is helpful, the original table spans 10+ pages)

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

(A section of the table would ideally look like either of these (with the arrow representing the $\RHD$; couldn't find it on word)):

v1 enter image description here

Thank you for taking the time to read this. Am grateful for any help and guidance on this.

  • 2
    Please give a fully compilable code. – AndréC Jun 28 at 7:17
  • 2
    you have not provided a test document nor shown the error message but I would assume the undefined command was \RHD as you do not show any definition for that. – David Carlisle Jun 28 at 7:32
  • 1
    See also: tex.stackexchange.com/a/501280/134144 – leandriis Jun 28 at 8:09
  • 1
    @TheEconomist - An ideal test document (a) is compilable, (b) gives rises to the issue you want to fix, and (c) is minimal in the sense that it doesn't contain code that's not needed to satisfy (a) and (b). It's sometimes not easy to generate such a test document. Do peruse the posting I've just been asked to write a minimal working example (MWE), what is that, though, to learn more about what constitutes a useful test document. – Mico Jun 28 at 9:27
  • 1
    @TheEconomist yes basically somthing that makes your question understandable:-) You have posted some fragments of code but we can't run them but they use a command \RHD that I don't recognise and you say you had an undefined command error but don't say which command was undefined, so all I can do is guess that it is \RHD but that is unrelated to your question about itemize so the question is not really answerable. (Although Mico has taken a guess:-) – David Carlisle Jun 28 at 10:11
7

(augmented the answer by a second-level "btr" itemize-like environment per the OP's request.)

Rather than set up lots of individual tabular environments and create the itemized lists by hand, I suggest you employ the machinery of enumitem package, as is done below, to create two levels of a bespoke itemize-like list environment.

enter image description here

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

Addendum to address the OP's latest follow-up. My ability to explain things must have deteriorated significantly of late, as the new code you posted does pretty much the exact opposite of what I thought I had recommended.

  • If you use the bespoke btr list-like environments in a column of type p, there is absolutely no need to encase the btr material in a single-column tabular wrapper. Hence, do please replace

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

with

    \begin{btr}
    \item sample methodologies
        \begin{btr}
        \item hello
        \end{btr}
    \end{btr}
  • What I thought I was telling you to do was: If, for some reason, you do not want to use the bespoke list-like environments, then by all means use single-column tabular environments to create something that looks like it could have been generated by a list-type environment. I was going by your question, "would it be possible to implement your solution within individual tabular environments?" I thought that this meant you were looking for an alternative to the btr approach. Was I mistaken?
| improve this answer | |
  • 1
    +1 I like the idea of using before=\begin{minipage}{\linewidth}, after =\end{minipage},. – leandriis Jun 28 at 8:29
  • Thank you for this suggestion! – TheEconomist Jun 28 at 8:38
  • 2
    @TheEconomist: Using \newlist{btr}{itemize}{2} and something like \begin{btr} \item sample methodology \item sample methodology \begin{btr} \item subitem \end{btr} \item sample methodology \end{btr} & should give you correctly indented second level items. – leandriis Jun 28 at 8:55
  • 2
    @leandriis - Your suggestion will definitely work. I decided to go ahead and edit my answer to define both a 1st and a 2nd level list environment called "btr" -- mainly to get the opportunity to assign an even smaller black-triangle-right symbol to the 2nd-level items. – Mico Jun 28 at 9:04
  • 1
    @TheEconomist - Please see the edits I applied to code. To get "sub-bullets", as you put it, it's necessary to define 2 levels, rather than just 1 level, of the btr environment. Incidentally, do note that the btr list environments will work both in- and outside longtable environments. – Mico Jun 28 at 9:14

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.