ssconvert 转换为表格,但比例计算错误。
找了一圈也没找到解决办法,是不是ssconvert的表转换有问题?
\documentclass{article}
\def\inputGnumericTable{}
\usepackage{inputenc}
\usepackage{color}
\usepackage{array}
\usepackage{longtable}
\usepackage{calc}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{ifthen}
\usepackage{lscape}
\begin{document}
test
\input{te.tex}
\end{document}
te.tex
内容
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% This is the header of a LaTeX2e file exported from Gnumeric. %%
%% %%
%% This file can be compiled as it stands or included in another %%
%% LaTeX document. The table is based on the longtable package so %%
%% the longtable options (headers, footers...) can be set in the %%
%% preamble section below (see PRAMBLE). %%
%% %%
%% To include the file in another, the following two lines must be %%
%% in the including file: %%
%% \def\inputGnumericTable{} %%
%% at the beginning of the file and: %%
%% \input{name-of-this-file.tex} %%
%% where the table is to be placed. Note also that the including %%
%% file must use the following packages for the table to be %%
%% rendered correctly: %%
%% \usepackage[latin1]{inputenc} %%
%% \usepackage{color} %%
%% \usepackage{array} %%
%% \usepackage{longtable} %%
%% \usepackage{calc} %%
%% \usepackage{multirow} %%
%% \usepackage{hhline} %%
%% \usepackage{ifthen} %%
%% optionally (for landscape tables embedded in another document): %%
%% \usepackage{lscape} %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This section checks if we are begin input into another file or %%
%% the file will be compiled alone. First use a macro taken from %%
%% the TeXbook ex 7.7 (suggestion of Han-Wen Nienhuys). %%
\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
%% Check for the \def token for inputed files. If it is not %%
%% defined, the file will be processed as a standalone and the %%
%% preamble will be used. %%
\ifundefined{inputGnumericTable}
%% We must be able to close or not the document at the end. %%
\def\gnumericTableEnd{\end{document}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% This is the PREAMBLE. Change these values to get the right %%
%% paper size and other niceties. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt%
%,landscape%
]{report}
\usepackage[latin1]{inputenc}
\usepackage{fullpage}
\usepackage{color}
\usepackage{array}
\usepackage{longtable}
\usepackage{calc}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{ifthen}
\begin{document}
%% End of the preamble for the standalone. The next section is for %%
%% documents which are included into other LaTeX2e files. %%
\else
%% We are not a stand alone document. For a regular table, we will %%
%% have no preamble and only define the closing to mean nothing. %%
\def\gnumericTableEnd{}
%% If we want landscape mode in an embedded document, comment out %%
%% the line above and uncomment the two below. The table will %%
%% begin on a new page and run in landscape mode. %%
% \def\gnumericTableEnd{\end{landscape}}
% \begin{landscape}
%% End of the else clause for this file being \input. %%
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% The rest is the gnumeric table, except for the closing %%
%% statement. Changes below will alter the table's appearance. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand{\gnumericmathit}[1]{#1}
%% Uncomment the next line if you would like your numbers to be in %%
%% italics if they are italizised in the gnumeric table. %%
%\renewcommand{\gnumericmathit}[1]{\mathit{#1}}
\providecommand{\gnumericPB}[1]%
{\let\gnumericTemp=\\#1\let\\=\gnumericTemp\hspace{0pt}}
\ifundefined{gnumericTableWidthDefined}
\newlength{\gnumericTableWidth}
\newlength{\gnumericTableWidthComplete}
\newlength{\gnumericMultiRowLength}
\global\def\gnumericTableWidthDefined{}
\fi
%% The following setting protects this code from babel shorthands. %%
\ifthenelse{\isundefined{\languageshorthands}}{}{\languageshorthands{english}}
%% The default table format retains the relative column widths of %%
%% gnumeric. They can easily be changed to c, r or l. In that case %%
%% you may want to comment out the next line and uncomment the one %%
%% thereafter %%
\providecommand\gnumbox{\makebox[0pt]}
%%\providecommand\gnumbox[1][]{\makebox}
%% to adjust positions in multirow situations %%
\setlength{\bigstrutjot}{\jot}
\setlength{\extrarowheight}{\doublerulesep}
%% The \setlongtables command keeps column widths the same across %%
%% pages. Simply comment out next line for varying column widths. %%
\setlongtables
\setlength\gnumericTableWidth{%
218pt+%
218pt+%
218pt+%
0pt}
\def\gumericNumCols{3}
\setlength\gnumericTableWidthComplete{\gnumericTableWidth+%
\tabcolsep*\gumericNumCols*2+\arrayrulewidth*\gumericNumCols}
\ifthenelse{\lengthtest{\gnumericTableWidthComplete > \linewidth}}%
{\def\gnumericScale{\ratio{\linewidth-%
\tabcolsep*\gumericNumCols*2-%
\arrayrulewidth*\gumericNumCols}%
{\gnumericTableWidth}}}%
{\def\gnumericScale{1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% The following are the widths of the various columns. We are %%
%% defining them here because then they are easier to change. %%
%% Depending on the cell formats we may use them more than once. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifthenelse{\isundefined{\gnumericColA}}{\newlength{\gnumericColA}}{}\settowidth{\gnumericColA}{\begin{tabular}{@{}p{218pt*\gnumericScale}@{}}x\end{tabular}}
\ifthenelse{\isundefined{\gnumericColB}}{\newlength{\gnumericColB}}{}\settowidth{\gnumericColB}{\begin{tabular}{@{}p{218pt*\gnumericScale}@{}}x\end{tabular}}
\ifthenelse{\isundefined{\gnumericColC}}{\newlength{\gnumericColC}}{}\settowidth{\gnumericColC}{\begin{tabular}{@{}p{218pt*\gnumericScale}@{}}x\end{tabular}}
\begin{longtable}[c]{%
b{\gnumericColA}%
b{\gnumericColB}%
b{\gnumericColC}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The longtable options. (Caption, headers... see Goosens, p.124) %%
% \caption{The Table Caption.} \\ %
% \hline % Across the top of the table.
%% The rest of these options are table rows which are placed on %%
%% the first, last or every page. Use \multicolumn if you want. %%
%% Header for the first page. %%
% \multicolumn{3}{c}{The First Header} \\ \hline
% \multicolumn{1}{c}{colTag} %Column 1
% &\multicolumn{1}{c}{colTag} %Column 2
% &\multicolumn{1}{c}{colTag} \\ \hline %Last column
% \endfirsthead
%% The running header definition. %%
% \hline
% \multicolumn{3}{l}{\ldots\small\slshape continued} \\ \hline
% \multicolumn{1}{c}{colTag} %Column 1
% &\multicolumn{1}{c}{colTag} %Column 2
% &\multicolumn{1}{c}{colTag} \\ \hline %Last column
% \endhead
%% The running footer definition. %%
% \hline
% \multicolumn{3}{r}{\small\slshape continued\ldots} \\
% \endfoot
%% The ending footer definition. %%
% \multicolumn{3}{c}{That's all folks} \\ \hline
% \endlastfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hhline{|-|-|-}
\multicolumn{1}{|p{\gnumericColA}|}%
{\gnumericPB{\centering}\gnumbox{1}}
&\multicolumn{1}{p{\gnumericColB}|}%
{\gnumericPB{\centering}\gnumbox{2}}
&\multicolumn{1}{p{\gnumericColC}|}%
{\gnumericPB{\centering}\gnumbox{3}}
\\
\hhline{|---|}
\multicolumn{1}{|p{\gnumericColA}|}%
{\setlength{\gnumericMultiRowLength}{0pt}%
\addtolength{\gnumericMultiRowLength}{\gnumericColA}%
\multirow{3}[1]{\gnumericMultiRowLength}{\parbox{\gnumericMultiRowLength}{%
\gnumericPB{\centering}\gnumbox{4}}}}
&\multicolumn{1}{p{\gnumericColB}|}%
{\gnumericPB{\centering}\gnumbox{6}}
&\multicolumn{1}{p{\gnumericColC}|}%
{\gnumericPB{\centering}\gnumbox{7}}
\\
\hhline{~|-|-|}
\multicolumn{1}{|p{\gnumericColA}|}%
{}
&\multicolumn{2}{p{ \gnumericColB+%
\gnumericColC+%
\tabcolsep*2*1}|}%
{\gnumericPB{\centering}\gnumbox{5}}
\\
\hhline{~|-|-|}
\multicolumn{1}{|p{\gnumericColA}|}%
{}
&\multicolumn{1}{p{\gnumericColB}|}%
{\gnumericPB{\centering}\gnumbox{8}}
&\multicolumn{1}{p{\gnumericColC}|}%
{\gnumericPB{\centering}\gnumbox{9}}
\\
\hhline{|-|-|-|}
\end{longtable}
\ifthenelse{\isundefined{\languageshorthands}}{}{\languageshorthands{\languagename}}
\gnumericTableEnd
错误说明:
Missing number, treated as zero. ...{218pt*\gnumericScale}@{}}x\end{tabular}}
答案1
这个问题已经解决了。
我看到了
https://tex.stackexchange.com/questions/437488/store-result-of-ratio-calculation-for-repeated-use
我懂了