如何将表格移动到投影仪框架的左侧?

如何将表格移动到投影仪框架的左侧?

我想将表格移到框架左侧,以便为其他列留出足够的空间。我使用 \longtable,因为内容很多,还使用 ​​logtable 添加了一张额外的幻灯片。

在此处输入图片描述

 \documentclass{beamer}
 \usepackage{lmodern,tabularx,ragged2e,booktabs}
 \newcolumntype{Y}{>{\arraybackslash\RaggedRight}X} %%% for tiny table
\newcolumntype{P}[1]{>{\arraybackslash\RaggedRight}p{#1}} %% for tiny table
\usepackage{cite}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{longtable}
\begin{document}
\begin{frame}[c,allowframebreaks]
    \setlength\tabcolsep{2.5pt}  
    \tiny  %%  command to change the font size
    \begin{table}
        \hspace*{-\leftmargin}
        \renewcommand{\arraystretch}{1.5}
        \caption{Recent studies}
        \label{tableM} % table 2


    \begin{longtable}{p{1.4cm} l p{1cm}p{2cm}p{0.5cm}lp{0.5cm}p{0.5cm}p{0.5cm}}
            \hline

            Approach        &       Reference           &Domain             &Technique/strategies   &Hybrid method  & Sparsity  &   Cold-start& Scalability & Accuracy \\  \hline 

            Memory-based    &\cite{jhalani2016linear}   &Movie          &Linear regression      & \xmark                &    \xmark         &    \xmark         &    \xmark & \cmark \\             
            Memory-based    &\cite{kant2017enhanced}    &Movie          &Fuzzy bayesian             &  \xmark & \xmark & \xmark & \cmark & \cmark \\
            Memory-based    &\cite{mikeli2013multi}     &Movie          &Analytic hierarchy process (AHP) &\xmark  &  \xmark & \xmark  & \xmark & \cmark\\      
            Memory-based    &\cite{turk2019robustness}  &Movie          &Shilling Attack        &\xmark  &  \xmark & \xmark  & \xmark & \cmark\\
            Memory-based    &\cite{winarko2014improving}&Document       &Combination algorithm  &\xmark  &  \xmark & \xmark  & \xmark & \cmark\\        
 ...


 ....
\hline
\end{longtable}
\end{table}
\end{frame}

\end{document}

答案1

表格的第一列包含重复的内容,不妨将其放在子行标题中。少处理 1 列非常有益,因为它允许您将相对字体大小从 更改\tiny\scriptsize

我还允许在最后五列中换行。

无论您做什么,都不要将 a 包裹longtable在 a 里面table

在此处输入图片描述

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern,tabularx,ragged2e,booktabs,longtable}
\newcolumntype{Y}{>{\RaggedRight}X} 
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}} 
\newcolumntype{C}[1]{>{\Centering\hspace{0pt}}p{#1}} 

\usepackage{cite}
\usepackage{amssymb}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}
\newcommand{\xmark}{\ding{55}}

\begin{document}
\begin{frame}[allowframebreaks]
\frametitle{Recent studies in MCRS}
\setlength\tabcolsep{3pt}  % default: 6pt
\scriptsize  
\renewcommand{\arraystretch}{1.333} % '1.50' seems excessive

\begin{longtable}{@{} P{2cm} l P{2cm} C{9mm} *{4}{C{8mm}} @{}}
% header and footer settings
\toprule
Reference & Domain & Technique\slash strategies 
& Hybrid method & Sparsity & Cold-start & Scalability & Accuracy \\  
\midrule
\endhead

\midrule
\endfoot

\bottomrule
\endlastfoot

% body of longtable
\multicolumn{5}{@{}l}{A. Memory-based approaches}\\
\cite{jhalani2016linear}   &Movie    &Linear regression      &\xmark &\xmark & \xmark & \xmark & \cmark \\             
\cite{kant2017enhanced}    &Movie    &Fuzzy Bayesian         &\xmark &\xmark & \xmark & \cmark & \cmark \\
\cite{mikeli2013multi}     &Movie    &Analytic hierarchy process (AHP) &\xmark & \xmark & \xmark & \xmark & \cmark\\      
\cite{turk2019robustness}  &Movie    &Shilling Attack        &\xmark &\xmark & \xmark & \xmark & \cmark\\
\cite{winarko2014improving}&Document &Combination algorithm  &\xmark &\xmark & \xmark & \xmark & \cmark\\        
\dots & \dots & \dots \\
\end{longtable}
\end{frame}

\end{document}

相关内容