文本溢出单元格

文本溢出单元格

尽管我已为“Endomorphism”提供了连字符,但它仍溢出单元格。这可能是什么原因造成的?

\documentclass[11pt]{article}
\usepackage{array, tabularx,  ragged2e,  booktabs} % nice tables
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % left-aligned text with linebreaks in tables
\newcolumntype{R}{>{\RaggedLeft\arraybackslash}X} % right-aligned text with linebreaks in tables
\usepackage{fullpage} % more space
\usepackage[primitives,keys]{cryptocode} % crypto stuff
\providecommand{\sign}{\pcalgostyle{Sign}}
\hyphenation{Endo-morphism}
\begin{document}


\begin{tabularx}{\linewidth}{@{} LLL *{6}{R} @{}} \toprule
    scheme & id scheme & transform & $\sign$ (kcycles) & $\verify$ (kcycles) & $\pk$ (bytes)  & $\sk$ (bytes) & $\sig$ (bytes) \\ \midrule
    Yoo et. al & SIDH Zk & Unruh & 28,776,000 & 19,679,000 & 336 & 48 & 122,880\\
    GPS & Endomorphism ring & Unruh & & & 192 & 64 & 540672\\
    SQI-Sign & Endomorphism ring & Unruh & 7,676,000 & 142,000 & 64 & 16 & 204\\
    SeaSign & Couveignes-Stolbunov & Fiat-Shamir with aborts & & & 40 & 20 & 12590 \\
    CSI-FiSh & Couveignes-Stolbunov & Fiat-Shamir & 1,744,600 & 964,600 & 32 & 8000 & 263\\
    Lossy CSI-FiSh & Lossy Couveignes-Stolbunov & Fiat-Shamir &  &  & 256 &  & 2405\\\bottomrule
    \hline
\end{tabularx}
\end{document}

输出

答案1

为了允许对表格单元格中的第一个单词进行连字符连接,您可以添加\hspace{0pt},可以在单个单元格中本地添加,也可以在列类型的定义中添加,L以影响L列中的所有单元格。

在以下 MWE 中,我做了一些调整以改善表格的对齐和可读性:我使用\thead来自makecell包的行来在列标题中引入换行符,并S使用来自的类型列siunitx来对齐最后 5 列中的数字。由于S类型列比您之前使用的列更窄R,因此前三列有更多可用空间,这有助于摆脱那里原本过满的框。最后,为了提供各个条目的视觉分离,我添加了\addlinespace来自booktabs包的行。(当然可以调整列标题的水平和垂直对齐。)

在此处输入图片描述

\documentclass[11pt]{article}
\usepackage{array, tabularx,  ragged2e,  booktabs} % nice tables
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X} % left-aligned text with linebreaks in tables
\newcolumntype{R}{>{\RaggedLeft\arraybackslash}X} % right-aligned text with linebreaks in tables
\usepackage{fullpage} % more space
\usepackage[primitives,keys]{cryptocode} % crypto stuff
\providecommand{\sign}{\pcalgostyle{Sign}}
\hyphenation{Endo-morphism}

\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\usepackage{siunitx}
\sisetup{group-separator={,}}
\begin{document}


\begin{tabularx}{\linewidth}{@{} LLL 
                                 S[table-format=8] 
                                 S[table-format=8]
                                 S[table-format=3]
                                 S[table-format=4]
                                 S[table-format=6]@{}} 
  \toprule
    \thead{scheme} 
      & \thead{id scheme} 
        & \thead{transform} 
          & {\thead{$\sign$\\ (kcycles)}} 
            & {\thead{$\verify$\\ (kcycles)}}
              & {\thead{$\pk$\\ (bytes)}}  
                & {\thead{$\sk$\\ (bytes)}} 
                  & {\thead{$\sig$\\ (bytes)}} \\ 
  \midrule
    Yoo et. al     & SIDH Zk                    & Unruh                   & 28776000 & 19679000 & 336 & 48   & 122880 \\ \addlinespace
    GPS            & Endomorphism ring          & Unruh                   &          &          & 192 & 64   & 540672 \\ \addlinespace
    SQI-Sign       & Endomorphism ring          & Unruh                   & 7676000  & 142000   & 64  & 16   & 204    \\ \addlinespace
    SeaSign        & Couveignes-Stolbunov       & Fiat-Shamir with aborts &          &          & 40  & 20   & 12590  \\ \addlinespace
    CSI-FiSh       & Couveignes-Stolbunov       & Fiat-Shamir             & 1744600  & 964600   & 32  & 8000 & 263    \\ \addlinespace
    Lossy CSI-FiSh & Lossy Couveignes-Stolbunov & Fiat-Shamir             &          &          & 256 &      & 2405   \\
  \bottomrule
\end{tabularx}
\end{document}

相关内容