在表格数组中旋转文本

在表格数组中旋转文本

我有下表:

\documentclass{article}
\usepackage{caption}
%------ tables
\usepackage{rotating}
\usepackage{makecell}
\usepackage{xcolor}
    \colorlet{bgodd}{black!10}
\usepackage{tabularray}
     \UseTblrLibrary{booktabs}
%------



\begin{document}

bla bla bla

\clearpage
\newpage

\clearpage
\newpage

\begin{sidewaystable*}[ht]
    
    \centering
    \caption{Papers analyzed in the survey grouped by data sources employed, and techniques used to detect anomalies.}
    %\caption{Papers analyzed in the survey grouped by data sources employed, and techniques used to detect anomalies}
    % from makecell
    \settowidth\rotheadsize{\small Monitoring-Based}
    \footnotesize
    \setlength\tabcolsep{0.1mm} % let LaTeX calculate intercolumn whitespace
    \begin{tblr}{
        width=\textheight-3\baselineskip,  % <--- added
        colspec = {l *{13}{X[c]}},
        vline{2-Y} = {2-Z}{dotted},
        vline{2,5} = {1-Z}{solid, \lightrulewidth}, % \lightrulewidth is defined in booktabs
        colsep = 1pt,                               % <--- changed
        row{1} = {font=\bfseries, c, m},
        row{2} = {cmd=\rotcell},
        row{odd [3-Y]} = {bg=bgodd},                % <--- changed
        }
        \toprule
        \SetRow{bg=white}
        Paper(s) &
        \SetCell[c=3]{c, m} {Data\\ Sources} &&&
            \SetCell[c=10]{c, m} Technique &&&&&&&&& \\
        \midrule
        & Log-based
            & Distributed Tracing-based
            & Monitoring-Based
            & {Unsupervised\\ learning}
            & {Supervised\\ learning}
            & Reinforcement learning
            & Semi-supervised learning
            & Hybrid learning
            & {Statistical\\ Approach}
            & Causal Inference
            & {Trace\\ comparison}
            & Heart Beating
            & SLO checks \\
        \midrule
        \cite{liu2020unsupervised, pahl2018all, jin2020anomaly, bogatinovski2020self} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        \textbullet &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
           % SLO checks 
        \\
        \cite{nedelkoski2019anomaly, gan2019leveraging, zhou2019latent} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        \textbullet &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{wang2020workflow, chen2020framework, meng2021detecting} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        \textbullet &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{li2021microservice} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        \textbullet &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{chow2014mystery} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        \textbullet &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{belhadi2021reinforcement} &
        &  % Log-based
        \textbullet &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        \textbullet &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{sharma2013cloudpd, zhang2016taskinsight, xu2018unsupervised, gulenko2018detecting, mariani2018localizing, wu2020microrca, wu2020performance, wang2018cloudranger, vallis2014novel, su2019robust, huang2013lof, bhaduri2011detecting,wang2012workload, lazarevic2003comparative} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        \textbullet &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{sauvanaud2018anomaly, liu2015opprentice, du2018anomaly, mariani2020predicting} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        &   % Unsupervised learning
        \textbullet &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{magalhaes2010detection, peiris2014pad, abdelrahman2016detection, kang2012dapa, yang2007anomaly, wang2013energy, ahad2015toward, nguyen2013fchain, tan2012prepare, gu2009online, samir2019dla} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        \textbullet &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{wu2021causal, chen2014causeinfer, chen2016causeinfer, lin2018microscope} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        \textbullet &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
         % SLO checks 
        \\
        \cite{shan2019diagnosis} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        \textbullet  % SLO checks 
        \\
        \cite{zang2018fault} &
        &  % Log-based
        &   % Distributed Tracing-based
        \textbullet &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        \textbullet  &   % HeartBeating
        % SLO checks 
        \\
        \cite{yagoub2018equipment, brown2018recurrent, nandi2016anomaly, jia2017logsed, fu2009execution, du2017deeplog} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        \textbullet &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
        \cite{fronza2013failure, zhang2016automated, zhang2019robust, liang2007failure} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        \textbullet &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
        \cite{meng2019loganomaly} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        \textbullet &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
       \cite{meng2019loganomaly, yang2021semi, li2021microservice} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        \textbullet &   % Semi-supervised learning
        &   % Hybrid learning
        &   % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
        \cite{salfner2007using, beschastnikh2014inferring} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        &   % Hybrid learning
        \textbullet &  % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
        \cite{he2020loghub} &
        \textbullet &  % Log-based
        &   % Distributed Tracing-based
        &   % Monitoring-Based
        &   % Unsupervised learning
        &   % Supervised learning
        &   % Reinforcement learning
        &   % Semi-supervised learning
        \textbullet &   % Hybrid learning
        &  % Statistical Approach
        &   % Causal Inference
        &   % Trace comparison
        &   % HeartBeating
        % SLO checks 
        \\
        \midrule
    \end{tblr}  
    {\label{tab:tbl_results}}
\end{sidewaystable*}

\clearpage
\newpage

bla bla

\end{document}

截屏:

在此处输入图片描述

我必须从第二行开始旋转,这样它才可读,即 270 度。我在第 41 行使用 rotcell 命令没有成功。你知道如何旋转此行的文本吗?

目标是:

在此处输入图片描述

解决方案:

我添加了@Celdor 的解决方案:

\renewcommand\cellrotangle{270}

而且它确实有效。

谢谢。

答案1

为什么您认为旋转 270 度的文本比旋转 90 度的文本更具可读性?例如,期刊或会议论文中的文章通常是双面的。在这种情况下,您的文档和表格序言如下:

\documentclass[twoside]{article}
\usepackage{caption}
%------ tables
\usepackage[clockwise]{rotating}
\usepackage{makecell}
\usepackage{xcolor}
    \colorlet{bgodd}{black!10}
\usepackage{tabularray}
     \UseTblrLibrary{booktabs}

\begin{document}
\begin{sidewaystable*}[ht]
    \centering
    \caption{Papers analyzed in the survey grouped by data sources employed, and techniques used to detect anomalies.}
\renewcommand\cellrotangle{270}
\settowidth\rotheadsize{\small Monitoring-Based}
    \footnotesize
    \begin{tblr}{
        width=\textheight,  % <--- added
        colspec = {l *{13}{X[c]}},
        vline{2-Y} = {2-Z}{dotted},
        vline{2,5} = {1-Z}{solid, \lightrulewidth}, % \lightrulewidth is defined in booktabs
        colsep = 2pt,                               % <--- changed
        row{1} = {font=\bfseries, c, m},
        row{2} = {cmd=\rotcell},
        row{odd [3-Y]} = {bg=bgodd},                % <--- changed
                }
% table body
...
    \bottomrule
    \end{tblr}
\end{sidewaystable*}
\end{document}

经过两次编译后得到以下结果:

在此处输入图片描述

如您所见,现在旋转后的文本从奇数页的第二行顶部开始,从偶数页的第二行底部开始。这就是您想要的吗?

附录: 以下解决方案可能会很方便:

\documentclass[twoside]{article}
\usepackage{caption}
%------ tables
\usepackage[clockwise]{rotating}
\usepackage{makecell}
\usepackage{xifthen}
%\ifthenelse{\isodd{thepage}}{\renewcommand\cellrotangle{90}}{\renewcommand\cellrotangle{270}} % start at top of row
\ifthenelse{\isodd{thepage}}{\renewcommand\cellrotangle{270}}{\renewcommand\cellrotangle{90}}  % start at bottom of row

\usepackage{xcolor}
    \colorlet{bgodd}{black!10}
\usepackage{tabularray}
     \UseTblrLibrary{booktabs}


\begin{document}
\begin{sidewaystable*}[ht]
    \centering
\caption{Papers analyzed in the survey grouped by data sources employed, and techniques used to detect anomalies.}
\label{tab:tbl_results}
\settowidth\rotheadsize{\small Monitoring-Based}
\footnotesize
    \begin{tblr}{
        width=\textheight,  % <--- added
        colspec = {l *{13}{X[c]}},
        vline{2-Y} = {2-Z}{dotted},
        vline{2,5} = {1-Z}{solid, \lightrulewidth}, % \lightrulewidth is defined in booktabs
        colsep = 2pt,                               % <--- changed
        row{1} = {font=\bfseries, c, m},
        row{2} = {cmd=\rotcell},
        row{odd [3-Y]} = {bg=bgodd},                % <--- changed
                }
% table body
        \toprule
...
    \bottomrule
    \end{tblr}
\end{sidewaystable*}
\end{document}

在此处输入图片描述

相关内容