将值代入表格的算法

将值代入表格的算法

简单来说,如果我有如下形式的表格:

    \begin{tabular}{l r r r r r l r r r r r}
    \hline
    {}&{}&{}&$n$&{}&{}&{}&{}&{}&$n$&{}&{}\\
    \cline{2-6}\cline{8-12}
    {}&1&2&3&4&5&{}&1&2&3&4&5\\
    \hline
$Q(n+0)$&1&1&2&3&3&$Q(n+100)$&48&54&54&50&60\\
$Q(n+5)$&4&5&5&6&6&$Q(n+105)$&52&54&58&60&53\\
$Q(n+10)$&6&8&8&8&10&$Q(n+110)$&60&60&52&62&66\\
$Q(n+15)$&9&10&11&11&12&$Q(n+115)$&55&62&68&62&58\\
$Q(n+20)$&12&12&12&16&14&$Q(n+120)$&72&58&61&78&57\\
$Q(n+25)$&14&16&16&16&16&$Q(n+125)$&71&68&64&63&73\\
$Q(n+30)$&20&17&17&20&21&$Q(n+130)$&63&71&72&72&80\\
$Q(n+35)$&19&20&22&21&22&$Q(n+135)$&61&71&77&65&80\\
$Q(n+40)$&23&23&24&24&24&$Q(n+140)$&71&69&77&75&73\\
$Q(n+45)$&24&24&32&24&25&$Q(n+145)$&77&79&76&80&79\\
$Q(n+50)$&30&28&26&30&30&$Q(n+150)$&75&82&77&80&80\\
$Q(n+55)$&28&32&30&32&32&$Q(n+155)$&78&83&83&78&85\\
$Q(n+60)$&32&32&40&33&31&$Q(n+160)$&82&85&84&84&88\\
$Q(n+65)$&38&35&33&39&40&$Q(n+165)$&83&87&88&87&86\\
$Q(n+70)$&37&38&40&39&40&$Q(n+170)$&90&88&87&92&90\\
$Q(n+75)$&39&42&40&41&43&$Q(n+175)$&91&92&92&94&92\\
$Q(n+80)$&44&43&43&46&44&$Q(n+180)$&93&94&94&96&94\\
$Q(n+85)$&45&47&47&46&48&$Q(n+185)$&96&96&96&96&96\\
$Q(n+90)$&48&48&48&48&48&$Q(n+190)$&96&128&72&96&115\\
$Q(n+95)$&64&41&52&54&56&$Q(n+195)$&100&84&114&110&93\\
    \hline
\end{tabular}
}

有没有办法可以自动编辑语法中的数值?我想这样做,这样我就可以获取 excel 中的值表,然后将这些表中的值“复制”到此表单中,这样我就可以相对快速地制作所有必要的表格。提前致谢。

答案1

pgfplotstable支持它。为此,您定义一个新的列类型(我选择了L),如以下示例所示。

请注意,这也会尝试格式化空单元格。为了解决此限制,我引入了一个宏\EMPTY,通过 禁用新列类型\multicolumn{1}{r}{}

\EMPTY这是您的示例。唯一的区别是列类型定义和标题行中的使用:

\documentclass{standalone}

\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{colortbl}

\begin{document}

\newcommand\EMPTY{\multicolumn{1}{r}{}}

\newcolumntype{L}[1]
    {>{\begin{pgfplotstablecoltype}[#1]}r<{\end{pgfplotstablecoltype}}}

    \begin{tabular}{l L{fixed,fixed zerofill} L{sci,sci zerofill} r r r l r r r L{fixed,precision=1,fixed zerofill} r}
    \hline
    \EMPTY&\EMPTY&\EMPTY&$n$&\EMPTY&\EMPTY&\EMPTY&\EMPTY&\EMPTY&$n$&\EMPTY&\EMPTY\\
    \cline{2-6}\cline{8-12}
    {}&1&2&3&4&5&{}&1&2&3&4&5\\
    \hline
$Q(n+0)$&1&1&2&3&3&$Q(n+100)$&48&54&54&50&60\\
$Q(n+5)$&4&5&5&6&6&$Q(n+105)$&52&54&58&60&53\\
$Q(n+10)$&6&8&8&8&10&$Q(n+110)$&60&60&52&62&66\\
$Q(n+15)$&9&10&11&11&12&$Q(n+115)$&55&62&68&62&58\\
$Q(n+20)$&12&12&12&16&14&$Q(n+120)$&72&58&61&78&57\\
$Q(n+25)$&14&16&16&16&16&$Q(n+125)$&71&68&64&63&73\\
$Q(n+30)$&20&17&17&20&21&$Q(n+130)$&63&71&72&72&80\\
$Q(n+35)$&19&20&22&21&22&$Q(n+135)$&61&71&77&65&80\\
$Q(n+40)$&23&23&24&24&24&$Q(n+140)$&71&69&77&75&73\\
$Q(n+45)$&24&24&32&24&25&$Q(n+145)$&77&79&76&80&79\\
$Q(n+50)$&30&28&26&30&30&$Q(n+150)$&75&82&77&80&80\\
$Q(n+55)$&28&32&30&32&32&$Q(n+155)$&78&83&83&78&85\\
$Q(n+60)$&32&32&40&33&31&$Q(n+160)$&82&85&84&84&88\\
$Q(n+65)$&38&35&33&39&40&$Q(n+165)$&83&87&88&87&86\\
$Q(n+70)$&37&38&40&39&40&$Q(n+170)$&90&88&87&92&90\\
$Q(n+75)$&39&42&40&41&43&$Q(n+175)$&91&92&92&94&92\\
$Q(n+80)$&44&43&43&46&44&$Q(n+180)$&93&94&94&96&94\\
$Q(n+85)$&45&47&47&46&48&$Q(n+185)$&96&96&96&96&96\\
$Q(n+90)$&48&48&48&48&48&$Q(n+190)$&96&128&72&96&115\\
$Q(n+95)$&64&41&52&54&56&$Q(n+195)$&100&84&114&110&93\\
    \hline
\end{tabular}
\end{document}

在此处输入图片描述

答案2

Gnumeric本身就足够强大,可以构建模板并LaTeX使用字符串连接将其转换为表格。例如,查看gnumeric-table.xml 使用创建的模板Gnumeric Spreadsheet 1.10.17

<?xml version="1.0" encoding="UTF-8"?>
<gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v9.xsd">
  <gnm:Version Epoch="1" Major="10" Minor="17" Full="1.10.17"/>
  <gnm:Attributes>
    <gnm:Attribute>
      <gnm:type>4</gnm:type>
      <gnm:name>WorkbookView::show_horizontal_scrollbar</gnm:name>
      <gnm:value>TRUE</gnm:value>
    </gnm:Attribute>
    <gnm:Attribute>
      <gnm:type>4</gnm:type>
      <gnm:name>WorkbookView::show_vertical_scrollbar</gnm:name>
      <gnm:value>TRUE</gnm:value>
    </gnm:Attribute>
    <gnm:Attribute>
      <gnm:type>4</gnm:type>
      <gnm:name>WorkbookView::show_notebook_tabs</gnm:name>
      <gnm:value>TRUE</gnm:value>
    </gnm:Attribute>
    <gnm:Attribute>
      <gnm:type>4</gnm:type>
      <gnm:name>WorkbookView::do_auto_completion</gnm:name>
      <gnm:value>TRUE</gnm:value>
    </gnm:Attribute>
    <gnm:Attribute>
      <gnm:type>4</gnm:type>
      <gnm:name>WorkbookView::is_protected</gnm:name>
      <gnm:value>FALSE</gnm:value>
    </gnm:Attribute>
  </gnm:Attributes>
  <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2">
    <office:meta>
      <dc:date>2013-11-26T09:02:25Z</dc:date>
      <meta:creation-date>2013-11-26T06:36:22Z</meta:creation-date>
    </office:meta>
  </office:document-meta>
  <gnm:Calculation ManualRecalc="0" EnableIteration="1" MaxIterations="100" IterationTolerance="0.001" FloatRadix="2" FloatDigits="53"/>
  <gnm:SheetNameIndex>
    <gnm:SheetName gnm:Cols="256" gnm:Rows="65536">Sheet1</gnm:SheetName>
    <gnm:SheetName gnm:Cols="256" gnm:Rows="65536">Sheet3</gnm:SheetName>
  </gnm:SheetNameIndex>
  <gnm:Geometry Width="918" Height="365"/>
  <gnm:Sheets>
    <gnm:Sheet DisplayFormulas="0" HideZero="0" HideGrid="0" HideColHeader="0" HideRowHeader="0" DisplayOutlines="1" OutlineSymbolsBelow="1" OutlineSymbolsRight="1" Visibility="GNM_SHEET_VISIBILITY_VISIBLE" GridColor="0:0:0">
      <gnm:Name>Sheet1</gnm:Name>
      <gnm:MaxCol>14</gnm:MaxCol>
      <gnm:MaxRow>12</gnm:MaxRow>
      <gnm:Zoom>1</gnm:Zoom>
      <gnm:Names>
        <gnm:Name>
          <gnm:name>Print_Area</gnm:name>
          <gnm:value>#REF!</gnm:value>
          <gnm:position>A1</gnm:position>
        </gnm:Name>
        <gnm:Name>
          <gnm:name>Sheet_Title</gnm:name>
          <gnm:value>&quot;Sheet1&quot;</gnm:value>
          <gnm:position>A1</gnm:position>
        </gnm:Name>
      </gnm:Names>
      <gnm:PrintInformation>
        <gnm:Margins>
          <gnm:top Points="120" PrefUnit="mm"/>
          <gnm:bottom Points="120" PrefUnit="mm"/>
          <gnm:left Points="72" PrefUnit="mm"/>
          <gnm:right Points="72" PrefUnit="mm"/>
          <gnm:header Points="72" PrefUnit="mm"/>
          <gnm:footer Points="72" PrefUnit="mm"/>
        </gnm:Margins>
        <gnm:Scale type="percentage" percentage="100"/>
        <gnm:vcenter value="0"/>
        <gnm:hcenter value="0"/>
        <gnm:grid value="0"/>
        <gnm:even_if_only_styles value="0"/>
        <gnm:monochrome value="0"/>
        <gnm:draft value="0"/>
        <gnm:titles value="0"/>
        <gnm:do_not_print value="0"/>
        <gnm:print_range value="0"/>
        <gnm:order>d_then_r</gnm:order>
        <gnm:orientation>portrait</gnm:orientation>
        <gnm:Header Left="" Middle="&amp;[TAB]" Right=""/>
        <gnm:Footer Left="" Middle="Page &amp;[PAGE]" Right=""/>
        <gnm:paper>na_letter</gnm:paper>
        <gnm:comments>in_place</gnm:comments>
        <gnm:errors>as_displayed</gnm:errors>
      </gnm:PrintInformation>
      <gnm:Styles>
        <gnm:StyleRegion startCol="0" startRow="0" endCol="0" endRow="15">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="0" startRow="16" endCol="15" endRow="255">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="0" startRow="256" endCol="63" endRow="65535">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="1" startRow="0" endCol="13" endRow="6">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="1" startRow="7" endCol="12" endRow="9">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Arial</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="1" startRow="10" endCol="12" endRow="15">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="13" startRow="7" endCol="13" endRow="8">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Arial</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="13" startRow="9" endCol="13" endRow="15">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="14" startRow="0" endCol="14" endRow="2">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="14" startRow="3" endCol="14" endRow="5">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Arial</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="14" startRow="6" endCol="14" endRow="6">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="14" startRow="7" endCol="14" endRow="9">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Arial</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="14" startRow="10" endCol="14" endRow="15">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="15" startRow="0" endCol="15" endRow="15">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="16" startRow="0" endCol="63" endRow="255">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
        <gnm:StyleRegion startCol="64" startRow="0" endCol="255" endRow="65535">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
      </gnm:Styles>
      <gnm:Cols DefaultSizePts="48">
        <gnm:ColInfo No="0" Unit="48" Count="2"/>
        <gnm:ColInfo No="2" Unit="15.75" Count="2"/>
        <gnm:ColInfo No="4" Unit="21.75"/>
        <gnm:ColInfo No="5" Unit="15.75"/>
        <gnm:ColInfo No="6" Unit="14.25"/>
        <gnm:ColInfo No="7" Unit="54.75"/>
        <gnm:ColInfo No="8" Unit="15.75" Count="2"/>
        <gnm:ColInfo No="10" Unit="21.75"/>
        <gnm:ColInfo No="11" Unit="15.75" Count="2"/>
        <gnm:ColInfo No="13" Unit="19.5" HardSize="1"/>
        <gnm:ColInfo No="14" Unit="267"/>
      </gnm:Cols>
      <gnm:Rows DefaultSizePts="12.75">
        <gnm:RowInfo No="0" Unit="12.75" Count="12"/>
      </gnm:Rows>
      <gnm:Selections CursorCol="12" CursorRow="13">
        <gnm:Selection startCol="12" startRow="13" endCol="12" endRow="13"/>
      </gnm:Selections>
      <gnm:Cells>
        <gnm:Cell Row="0" Col="5" ValueType="10"></gnm:Cell>
        <gnm:Cell Row="1" Col="1" ValueType="60">l</gnm:Cell>
        <gnm:Cell Row="1" Col="2" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="3" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="4" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="5" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="6" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="7" ValueType="60">l</gnm:Cell>
        <gnm:Cell Row="1" Col="8" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="9" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="10" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="11" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="12" ValueType="60">r</gnm:Cell>
        <gnm:Cell Row="1" Col="14">=&quot;\\begin{tabular}{&quot;&amp;concatenate($B$2:$M$2)&amp;&quot;}&quot;</gnm:Cell>
        <gnm:Cell Row="2" Col="14" ValueType="60">\hline</gnm:Cell>
        <gnm:Cell Row="3" Col="1" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="2" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="3" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="4" ValueType="60">$n$</gnm:Cell>
        <gnm:Cell Row="3" Col="5" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="6" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="7" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="8" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="9" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="10" ValueType="60">$n$</gnm:Cell>
        <gnm:Cell Row="3" Col="11" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="12" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="14" Rows="1" Cols="1">=B4&amp;concatenate(&quot;&amp;&quot;&amp;C4:M4)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="4" Col="14" ValueType="60"> \cline{2-6}\cline{8-12}</gnm:Cell>
        <gnm:Cell Row="5" Col="1" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="5" Col="2" ValueType="40">1</gnm:Cell>
        <gnm:Cell Row="5" Col="3" ValueType="40">2</gnm:Cell>
        <gnm:Cell Row="5" Col="4" ValueType="40">3</gnm:Cell>
        <gnm:Cell Row="5" Col="5" ValueType="40">4</gnm:Cell>
        <gnm:Cell Row="5" Col="6" ValueType="40">5</gnm:Cell>
        <gnm:Cell Row="5" Col="7" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="5" Col="8" ValueType="40">1</gnm:Cell>
        <gnm:Cell Row="5" Col="9" ValueType="40">2</gnm:Cell>
        <gnm:Cell Row="5" Col="10" ValueType="40">3</gnm:Cell>
        <gnm:Cell Row="5" Col="11" ValueType="40">4</gnm:Cell>
        <gnm:Cell Row="5" Col="12" ValueType="40">5</gnm:Cell>
        <gnm:Cell Row="5" Col="14" Rows="1" Cols="1">=B6&amp;concatenate(&quot;&amp;&quot;&amp;C6:M6)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="6" Col="14" ValueType="60">\hline</gnm:Cell>
        <gnm:Cell Row="7" Col="0" ValueType="40">0</gnm:Cell>
        <gnm:Cell Row="7" Col="1" ExprID="1">=&quot;$Q(n+&quot;&amp;A8&amp;&quot;)$&quot;</gnm:Cell>
        <gnm:Cell Row="7" Col="2" ValueType="40">1</gnm:Cell>
        <gnm:Cell Row="7" Col="3" ValueType="40">1</gnm:Cell>
        <gnm:Cell Row="7" Col="4" ValueType="40">2</gnm:Cell>
        <gnm:Cell Row="7" Col="5" ValueType="40">3</gnm:Cell>
        <gnm:Cell Row="7" Col="6" ValueType="40">3</gnm:Cell>
        <gnm:Cell Row="7" Col="7" ExprID="2">=&quot;$Q(n+&quot;&amp;A8+100&amp;&quot;)$&quot;</gnm:Cell>
        <gnm:Cell Row="7" Col="8" ValueType="40">48</gnm:Cell>
        <gnm:Cell Row="7" Col="9" ValueType="40">54</gnm:Cell>
        <gnm:Cell Row="7" Col="10" ValueType="40">54</gnm:Cell>
        <gnm:Cell Row="7" Col="11" ValueType="40">50</gnm:Cell>
        <gnm:Cell Row="7" Col="12" ValueType="40">60</gnm:Cell>
        <gnm:Cell Row="7" Col="14" Rows="1" Cols="1">=B8&amp;concatenate(&quot;&amp;&quot;&amp;C8:M8)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="8" Col="0" ExprID="3">=A8+5</gnm:Cell>
        <gnm:Cell Row="8" Col="1" ExprID="1"/>
        <gnm:Cell Row="8" Col="2" ValueType="40">4</gnm:Cell>
        <gnm:Cell Row="8" Col="3" ValueType="40">5</gnm:Cell>
        <gnm:Cell Row="8" Col="4" ValueType="40">5</gnm:Cell>
        <gnm:Cell Row="8" Col="5" ValueType="40">6</gnm:Cell>
        <gnm:Cell Row="8" Col="6" ValueType="40">6</gnm:Cell>
        <gnm:Cell Row="8" Col="7" ExprID="2"/>
        <gnm:Cell Row="8" Col="8" ValueType="40">52</gnm:Cell>
        <gnm:Cell Row="8" Col="9" ValueType="40">54</gnm:Cell>
        <gnm:Cell Row="8" Col="10" ValueType="40">58</gnm:Cell>
        <gnm:Cell Row="8" Col="11" ValueType="40">60</gnm:Cell>
        <gnm:Cell Row="8" Col="12" ValueType="40">53</gnm:Cell>
        <gnm:Cell Row="8" Col="14" Rows="1" Cols="1">=B9&amp;concatenate(&quot;&amp;&quot;&amp;C9:M9)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="9" Col="0" ExprID="3"/>
        <gnm:Cell Row="9" Col="1" ExprID="1"/>
        <gnm:Cell Row="9" Col="2" ValueType="40">6</gnm:Cell>
        <gnm:Cell Row="9" Col="3" ValueType="40">8</gnm:Cell>
        <gnm:Cell Row="9" Col="4" ValueType="40">8</gnm:Cell>
        <gnm:Cell Row="9" Col="5" ValueType="40">8</gnm:Cell>
        <gnm:Cell Row="9" Col="6" ValueType="40">10</gnm:Cell>
        <gnm:Cell Row="9" Col="7" ExprID="2"/>
        <gnm:Cell Row="9" Col="8" ValueType="40">60</gnm:Cell>
        <gnm:Cell Row="9" Col="9" ValueType="40">60</gnm:Cell>
        <gnm:Cell Row="9" Col="10" ValueType="40">52</gnm:Cell>
        <gnm:Cell Row="9" Col="11" ValueType="40">62</gnm:Cell>
        <gnm:Cell Row="9" Col="12" ValueType="40">66</gnm:Cell>
        <gnm:Cell Row="9" Col="14" Rows="1" Cols="1">=B10&amp;concatenate(&quot;&amp;&quot;&amp;C10:M10)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="11" Col="14" ValueType="60">\hline</gnm:Cell>
        <gnm:Cell Row="12" Col="14" ValueType="60">\end{tabular}</gnm:Cell>
      </gnm:Cells>
      <gnm:SheetLayout TopLeft="A1"/>
      <gnm:Solver ModelType="0" ProblemType="0" MaxTime="60" MaxIter="1000" NonNeg="1" Discr="0" AutoScale="0" ProgramR="0"/>
    </gnm:Sheet>
    <gnm:Sheet DisplayFormulas="0" HideZero="0" HideGrid="0" HideColHeader="0" HideRowHeader="0" DisplayOutlines="1" OutlineSymbolsBelow="1" OutlineSymbolsRight="1" Visibility="GNM_SHEET_VISIBILITY_VISIBLE" GridColor="0:0:0">
      <gnm:Name>Sheet3</gnm:Name>
      <gnm:MaxCol>14</gnm:MaxCol>
      <gnm:MaxRow>7</gnm:MaxRow>
      <gnm:Zoom>1</gnm:Zoom>
      <gnm:Names>
        <gnm:Name>
          <gnm:name>Print_Area</gnm:name>
          <gnm:value>#REF!</gnm:value>
          <gnm:position>A1</gnm:position>
        </gnm:Name>
        <gnm:Name>
          <gnm:name>Sheet_Title</gnm:name>
          <gnm:value>&quot;Sheet3&quot;</gnm:value>
          <gnm:position>A1</gnm:position>
        </gnm:Name>
      </gnm:Names>
      <gnm:PrintInformation>
        <gnm:Margins>
          <gnm:top Points="120" PrefUnit="mm"/>
          <gnm:bottom Points="120" PrefUnit="mm"/>
          <gnm:left Points="72" PrefUnit="mm"/>
          <gnm:right Points="72" PrefUnit="mm"/>
          <gnm:header Points="72" PrefUnit="mm"/>
          <gnm:footer Points="72" PrefUnit="mm"/>
        </gnm:Margins>
        <gnm:Scale type="percentage" percentage="100"/>
        <gnm:vcenter value="0"/>
        <gnm:hcenter value="0"/>
        <gnm:grid value="0"/>
        <gnm:even_if_only_styles value="0"/>
        <gnm:monochrome value="0"/>
        <gnm:draft value="0"/>
        <gnm:titles value="0"/>
        <gnm:do_not_print value="0"/>
        <gnm:print_range value="0"/>
        <gnm:order>d_then_r</gnm:order>
        <gnm:orientation>portrait</gnm:orientation>
        <gnm:Header Left="" Middle="&amp;[TAB]" Right=""/>
        <gnm:Footer Left="" Middle="Page &amp;[PAGE]" Right=""/>
        <gnm:paper>na_letter</gnm:paper>
        <gnm:comments>in_place</gnm:comments>
        <gnm:errors>as_displayed</gnm:errors>
      </gnm:PrintInformation>
      <gnm:Styles>
        <gnm:StyleRegion startCol="0" startRow="0" endCol="255" endRow="65535">
          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
            <gnm:Font Unit="10" Bold="0" Italic="0" Underline="0" StrikeThrough="0" Script="0">Sans</gnm:Font>
          </gnm:Style>
        </gnm:StyleRegion>
      </gnm:Styles>
      <gnm:Cols DefaultSizePts="48">
        <gnm:ColInfo No="1" Unit="48" Count="14"/>
      </gnm:Cols>
      <gnm:Rows DefaultSizePts="12.75">
        <gnm:RowInfo No="3" Unit="12.75" Count="5"/>
      </gnm:Rows>
      <gnm:Selections CursorCol="2" CursorRow="7">
        <gnm:Selection startCol="2" startRow="7" endCol="2" endRow="7"/>
      </gnm:Selections>
      <gnm:Cells>
        <gnm:Cell Row="3" Col="1" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="2" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="3" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="4" ValueType="60">$n$</gnm:Cell>
        <gnm:Cell Row="3" Col="5" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="6" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="7" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="8" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="9" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="10" ValueType="60">$n$</gnm:Cell>
        <gnm:Cell Row="3" Col="11" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="12" ValueType="60">{}</gnm:Cell>
        <gnm:Cell Row="3" Col="14" Rows="1" Cols="1">=B4&amp;concatenate(&quot;&amp;&quot;&amp;C4:M4)&amp;&quot; \\\\&quot;</gnm:Cell>
        <gnm:Cell Row="4" Col="1" ExprID="4">=A5+1</gnm:Cell>
        <gnm:Cell Row="4" Col="2" ExprID="4"/>
        <gnm:Cell Row="4" Col="3" ExprID="4"/>
        <gnm:Cell Row="4" Col="4" ExprID="4"/>
        <gnm:Cell Row="4" Col="5" ExprID="4"/>
        <gnm:Cell Row="4" Col="6" ExprID="4"/>
        <gnm:Cell Row="4" Col="7" ExprID="4"/>
        <gnm:Cell Row="4" Col="8" ExprID="4"/>
        <gnm:Cell Row="4" Col="9" ExprID="4"/>
        <gnm:Cell Row="4" Col="10" ExprID="4"/>
        <gnm:Cell Row="4" Col="11" ExprID="4"/>
        <gnm:Cell Row="4" Col="12" ExprID="4"/>
        <gnm:Cell Row="6" Col="2" Rows="1" Cols="1">=B4&amp;concatenate(&quot;&amp;&quot;&amp;C4:M4)</gnm:Cell>
        <gnm:Cell Row="7" Col="2" Rows="1" Cols="1">=B5&amp;concatenate(&quot;&amp;&quot;&amp;C5:M5)</gnm:Cell>
      </gnm:Cells>
      <gnm:SheetLayout TopLeft="A1"/>
      <gnm:Solver ModelType="0" ProblemType="0" MaxTime="60" MaxIter="1000" NonNeg="1" Discr="0" AutoScale="0" ProgramR="0"/>
    </gnm:Sheet>
  </gnm:Sheets>
  <gnm:UIData SelectedTab="0"/>
</gnm:Workbook>

B从到 的列M用于填充数据,列BH包含公式="$Q(n+"&A8&")$"="$Q(n+"&A8+100&")$",列O包含LaTeX表格。要扩展表格,只需将最后一行复制下来并填充数据即可。

在此处输入图片描述

完成MWE从以LaTeX下列复制的表格数据:Ognumeric-table.xml

\documentclass{article}
\usepackage{lmodern}
\begin{document}
\begin{tabular}{lrrrrrlrrrrr}
\hline
{}&{}&{}&$n$&{}&{}&{}&{}&{}&$n$&{}&{} \\
 \cline{2-6}\cline{8-12}
{}&1&2&3&4&5&{}&1&2&3&4&5 \\
\hline
$Q(n+0)$&1&1&2&3&3&$Q(n+100)$&48&54&54&50&60 \\
$Q(n+5)$&4&5&5&6&6&$Q(n+105)$&52&54&58&60&53 \\
$Q(n+10)$&6&8&8&8&10&$Q(n+110)$&60&60&52&62&66 \\

\hline
\end{tabular}
\end{document}

在此处输入图片描述

答案3

一个选择是使用计算器包,结合超表格式包将表格拆分为多页。选中我之前的回答作为如何将两者结合起来以自动化系统和复杂的表生成的示例。

答案4

实际上有一种方法可以从 Excel 复制整个表格并给出你想要的格式,它是一种补充,称为Excel 转 LaTeX。您可以在 Excel 中设计表格并编写其内容,然后选择要转换为 LaTeX 代码的单元格。也许您需要对生成的代码进行一些修改以满足您的需求(如果您使用下标、希腊字母等)。

您还需要使用该booktabs\usepackage{booktabs}

相关内容