<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>table on
A Scripter's Notes</title><link>https://scripter.co/tags/table/</link><description>Recent content in table
on A Scripter's Notes</description><language>en-us</language><managingEditor>kaushal.modi@gmail.com (Kaushal Modi)</managingEditor><webMaster>kaushal.modi@gmail.com (Kaushal Modi)</webMaster><lastBuildDate>Wed, 22 Apr 2026 08:24:58 -0400</lastBuildDate><generator>Hugo -- gohugo.io</generator><docs>https://validator.w3.org/feed/docs/rss2.html</docs><atom:link href="https://scripter.co/tags/table/index.xml" rel="self" type="application/rss+xml"/><item><title>Field Formatters in Org table</title><link>https://scripter.co/field-formatters-in-org-table/</link><description>&lt;blockquote>Using field-formatters to format results of Org table formulae.&lt;/blockquote>&lt;div class="ox-hugo-toc toc">
&lt;div class="heading">Table of Contents&lt;/div>
&lt;ul>
&lt;li>&lt;a href="#using-printf-style-0-dot-1f-formatter">Using &lt;code>printf&lt;/code> style &lt;code>%0.1f&lt;/code> formatter&lt;/a>&lt;/li>
&lt;li>&lt;a href="#using-calc-f1-formatter">Using &lt;em>Calc&lt;/em> &lt;code>f1&lt;/code> formatter&lt;/a>&lt;/li>
&lt;/ul>
&lt;/div>
&lt;!--endtoc-->
&lt;p>If you have a simple Org table like:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-org" data-lang="org">&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 0.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 1.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">|-----|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">| |&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And you want the &lt;em>A3&lt;/em> cell to contain the sum of &lt;em>A1&lt;/em> and &lt;em>A2&lt;/em> cells,
you would add this at the bottom on that table and evaluate it (&lt;kbd>C-c
C-c&lt;/kbd>).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-org" data-lang="org">&lt;span class="line">&lt;span class="cl">&lt;span class="cs">#+tblfm&lt;/span>&lt;span class="c">: @&amp;gt;$1=vsum(@1..@&amp;gt;&amp;gt;)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>That formula reads as: &amp;ldquo;Set the value of the cell is last row
(&lt;code>@&amp;gt;&lt;/code>)&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup>, first column (&lt;code>$1&lt;/code>) be equal to the sum of all cells in
the same column from row 1 (&lt;code>@1&lt;/code>) to second-to-the-last row (&lt;code>@&amp;gt;&amp;gt;&lt;/code>).&amp;rdquo;&lt;/p>
&lt;p>But then you end up with an odd-looking &lt;code>2.&lt;/code> instead of &lt;code>2.0&lt;/code> in the
result cell:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-org" data-lang="org">&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 0.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 1.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">|-----|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl">&lt;span class="s">| 2. |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="cs">#+tblfm&lt;/span>&lt;span class="c">: @&amp;gt;$1=vsum(@1..@&amp;gt;&amp;gt;)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>So I had &lt;a href="https://lists.gnu.org/r/emacs-orgmode/2016-04/msg00581.html">posted&lt;/a> a question on the Org mailing list to understand if
this was a bug &amp;mdash; &lt;em>it was not&lt;/em>.&lt;/p>
&lt;h2 id="using-printf-style-0-dot-1f-formatter">Using &lt;code>printf&lt;/code> style &lt;code>%0.1f&lt;/code> formatter&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#using-printf-style-0-dot-1f-formatter">#&lt;/a>&lt;/h2>
&lt;p>Thanks to the reply from Thierry Banel to that question, one of the
solutions is to use &lt;em>field formatters&lt;/em>, like in &lt;code>printf&lt;/code> in C (and
many other languages):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-org" data-lang="org">&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 0.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 1.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">|-----|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl">&lt;span class="s">| 2.0 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl">&lt;span class="cs">#+tblfm&lt;/span>&lt;span class="c">: @&amp;gt;$1=vsum(@1..@&amp;gt;&amp;gt;);%0.1f&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;h2 id="using-calc-f1-formatter">Using &lt;em>Calc&lt;/em> &lt;code>f1&lt;/code> formatter&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#using-calc-f1-formatter">#&lt;/a>&lt;/h2>
&lt;p>Another solution, also from Thierry, was to use the &lt;em>Calc&lt;/em> &lt;code>f1&lt;/code>
formatter instead of &lt;code>%0.1f&lt;/code> (and similarly &lt;code>f5&lt;/code> instead of &lt;code>%0.5f&lt;/code>).&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-org" data-lang="org">&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 0.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">| 1.5 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">|-----|&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl">&lt;span class="s">| 2.0 |&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl">&lt;span class="cs">#+tblfm&lt;/span>&lt;span class="c">: @&amp;gt;$1=vsum(@1..@&amp;gt;&amp;gt;);f1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;dl>
&lt;dt>Note&lt;/dt>
&lt;dd>While the &lt;code>%.1f&lt;/code> format is handy for those who are used to
&lt;code>printf()&lt;/code> syntax, note that Calc unlimited precision
numbers are converted to double floats before applying
&lt;code>%.1f&lt;/code>. Whereas &lt;code>f1&lt;/code> operates on Calc numbers without
conversion.&lt;/dd>
&lt;/dl>
&lt;div class="footnotes" role="doc-endnotes">
&lt;hr>
&lt;ol>
&lt;li id="fn:1">
&lt;p>See &lt;a href="https://orgmode.org/manual/References.html">&lt;abbr title="Read the same section within Emacs by doing 'C-h i g (org) References'">(org) References&lt;/abbr>&lt;/a> for more information on those field references.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;/ol>
&lt;/div></description><author>Kaushal.Modi@fakeEmailToMakeValidatorHappy.com (Kaushal Modi)</author><category domain="https://scripter.co/categories/emacs">emacs</category><category domain="https://scripter.co/categories/org">org</category><category domain="https://scripter.co/tags/table">table</category><category domain="https://scripter.co/tags/field-formatter">field-formatter</category><guid>https://scripter.co/field-formatters-in-org-table/</guid><pubDate>Mon, 05 Mar 2018 17:40:00 -0500</pubDate></item><item><title>How to quickly create a table in Org mode</title><link>https://scripter.co/how-to-quickly-create-a-table-in-org-mode/</link><description>&lt;p>Set the buffer major mode to &lt;code>org-mode&lt;/code>. If the file extension is
&lt;code>.org&lt;/code>, that major mode would be set automatically by emacs.&lt;/p>
&lt;p>Follow the below steps to create a table ..&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Start writing the headers of the table starting with a vertical pipe
&lt;code>|&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">| Header1 | Header2 | Header3 |▮
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Once you have finished writing the headers, do &lt;code>C-u C-c -&lt;/code> to insert
a horizontal line above the header row.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| Header1 | Header2 | Header3 |▮
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Then do &lt;code>C-c -&lt;/code> to insert a horizontal line below the header row.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| Header1 | Header2 | Header3 |▮
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Go down one row ( &lt;code>C-n&lt;/code> ) and hit TAB and org-mode will figure out
that you need to create a new row and will put the cursor in the
first cell of the new row.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| Header1 | Header2 | Header3 |
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">|▮ | | |
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>You can now use TAB and Shift + TAB to navigate the cells and new
rows will be created when you hit TAB when you are in the last cell
of the last created row.&lt;/p>
&lt;p>When you want to close the table with a bottom border, hit &lt;code>C-c -&lt;/code>
when the cursor is in the last row.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| Header1 | Header2 | Header3 |
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">| A | B | C▮ |
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">|---------+---------+---------|
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol></description><author>Kaushal.Modi@fakeEmailToMakeValidatorHappy.com (Kaushal Modi)</author><category domain="https://scripter.co/categories/emacs">emacs</category><category domain="https://scripter.co/categories/org">org</category><category domain="https://scripter.co/tags/table">table</category><guid>https://scripter.co/how-to-quickly-create-a-table-in-org-mode/</guid><pubDate>Wed, 28 May 2014 12:44:06 -0400</pubDate></item></channel></rss>