自动选择表格内的字体大小

自动选择表格内的字体大小

是否存在任何包/技巧,使ltablex tabularx表格动态调整其字体大小,以便表格占据整个页面(在我们的例子中是横向模式下的页面高度)?

示例/用例: 打印 Celero CSV 文件

此示例当前使用字体大小,tiny但是这会导致一些未使用的空间。small导致表格内溢出。

编辑:尝试了adjustboxresizebox。我有一些错误:我以以下方式实现它:

\documentclass[%
    pdftex,
    a4paper, 
    %letterpaper,
    oneside,        % Einseitiger Druck.
    12pt,           % Schriftgroesse
    parskip=half,   % Halbe Zeile Abstand zwischen Absätzen.
%   headsepline,    % Linie nach Kopfzeile.
    footsepline,    % Linie vor Fusszeile.
    plainfootsepline,
    abstracton,     % Abstract Überschriften
    english,        % Translator
    %enabledeprecatedfontcommands, %enable old commands ot use fancyhdr NOT RECOMMENDED
]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lscape}
\usepackage{pgfplotstable}
\usepackage{ltablex} % mix out of tabularx and longtable
\usepackage{multirow}
\begin{document}
\begin{landscape}
\newcommand{\headerCSV}{Group & Experiment & Problem Space & Samples & Iterations & Baseline & us/Iteration & Iterations/sec & Min (us) & Mean (us) & Max (us) & Variance & Standard Deviation & Skewness & Kurtosis & Z Score} % own Header
\setlength\tabcolsep{1.5pt} % save inner margin space
\resizebox{\linewidth}{!}{
\pgfplotstableread[col sep=comma]{results.csv}\data % Your CSV file
 \pgfplotstabletypeset[%
    begin table=\begin{tabularx}{\hsize},
    % Multi Page setup:
    every first row/.append style={before row={%
        \headerCSV \\ \hline
     \endfirsthead
         \multicolumn{16}{c}%
         {\textbf{Continued from previous page}} \\
         \hline
         \headerCSV \\ \hline
     \endhead
         \hline 
         \multicolumn{16}{c}%
         {\textbf{Continued on next page}} \\
     \endfoot
         \hline
         \multicolumn{16}{|r|}{{Concluded}} \\ 
         \hline
     \endlastfoot
     }
 },%
    end table=\end{tabularx},
    %
    column type/.add={|}{},
    empty cells with={---}, %replace empty cells with ’--’
    % Custom columns settings for every Celero output row
    columns/Group/.style={string type, column type=|l},
    columns/Experiment/.style={string type, column type=|l},
    columns/Problem Space/.style={string replace={-9223372036854775808}{}, column type=|X}, % no Problem Space --> empty
    columns/Samples/.style={column type=|X},
    columns/Iterations/.style={column type=|X},
    columns/Baseline/.style={column type=|X},
    columns/us/Iteration/.style={column type=|X},
    columns/Iterations/sec/.style={column type=|X},
    columns/Min (us)/.style={column type=|X},
    columns/Mean (us)/.style={column type=|X},
    columns/Max (us)/.style={column type=|X},
    columns/Variance/.style={column type=|X},
    columns/Standard Deviation/.style={column type=|X},
    columns/Skewness/.style={column type=|X},
    columns/Kurtosis/.style={column type=|X},
    columns/Z Score/.style={column type=|X|},
    every head row/.style={%
        after row=\hline,output empty row
    },
    columns={Group,Experiment,Problem Space,Samples,Iterations,Baseline,us/Iteration,Iterations/sec,Min (us),Mean (us),Max (us),Variance,Standard Deviation,Skewness,Kurtosis,Z Score},%
    /pgf/number format/fixed,
   /pgf/number format/precision=5,
]{\data}
} % end tiny
\end{landscape}
\end{document}

收到以下错误: Texmaker 的错误日志

好像有一个未关闭的对象。没有参数resizebox,它工作正常。

相关内容