Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 854e0a8f0f
Fetching contributors…

Cannot retrieve contributors at this time

1040 lines (787 sloc) 34.315 kb
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>README</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="title" content="README"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2012-08-02 14:28:15 EDT"/>
<meta name="author" content="Frozenlock"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
html { font-family: Times, serif; font-size: 12pt; }
.title { text-align: center; }
.todo { color: red; }
.done { color: green; }
.tag { background-color: #add8e6; font-weight:normal }
.target { }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right {margin-left:auto; margin-right:0px; text-align:right;}
.left {margin-left:0px; margin-right:auto; text-align:left;}
.center {margin-left:auto; margin-right:auto; text-align:center;}
p.verse { margin-left: 3% }
pre {
border: 1pt solid #AEBDCC;
background-color: #F3F5F7;
padding: 5pt;
font-family: courier, monospace;
font-size: 90%;
overflow:auto;
}
table { border-collapse: collapse; }
td, th { vertical-align: top; }
th.right { text-align:center; }
th.left { text-align:center; }
th.center { text-align:center; }
td.right { text-align:right; }
td.left { text-align:left; }
td.center { text-align:center; }
dt { font-weight: bold; }
div.figure { padding: 0.5em; }
div.figure p { text-align: center; }
div.inlinetask {
padding:10px;
border:2px solid gray;
margin:10px;
background: #ffffcc;
}
textarea { overflow-x: auto; }
.linenr { font-size:smaller }
.code-highlighted {background-color:#ffff00;}
.org-info-js_info-navigation { border-style:none; }
#org-info-js_console-label { font-size:10px; font-weight:bold;
white-space:nowrap; }
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
font-weight:bold; }
/*]]>*/-->
</style>
<script type="text/javascript">
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="preamble">
</div>
<div id="content">
<h1 class="title">README</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 BOM introduction</a></li>
<li><a href="#sec-2">2 BOM keywords</a>
<ul>
<li><a href="#sec-2-1">2.1 Component</a></li>
<li><a href="#sec-2-2">2.2 Section</a></li>
<li><a href="#sec-2-3">2.3 Qty</a></li>
<li><a href="#sec-2-4">2.4 Tag</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Renaming BOM columns</a></li>
<li><a href="#sec-4">4 Multiple component's column</a></li>
<li><a href="#sec-5">5 Precise section selection</a></li>
<li><a href="#sec-6">6 BOM total</a></li>
<li><a href="#sec-7">7 Adding a component without a table</a></li>
<li><a href="#sec-8">8 Moving components to another section</a></li>
<li><a href="#sec-9">9 Adding details</a>
<ul>
<li><a href="#sec-9-1">9.1 Description</a></li>
<li><a href="#sec-9-2">9.2 Price</a></li>
<li><a href="#sec-9-3">9.3 Datasheet</a></li>
</ul>
</li>
<li><a href="#sec-10">10 List of BOM parameters</a></li>
<li><a href="#sec-11">11 Advanced and elisp functions</a>
<ul>
<li><a href="#sec-11-1">11.1 Speed up updates</a></li>
<li><a href="#sec-11-2">11.2 LaTeX mode and bom-datasheet</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> BOM introduction</h2>
<div class="outline-text-2" id="text-1">
<p>
This add-on collects components across the entire org buffer (even
in drawers), making it easy to retrieve and sort data. It uses the
column special name as a landmark. We will refer to them as
'Keywords'. The keywords are searched using a string-match function,
which gives the ability to have multiple column with the same
functionality, but also to use the column name as we would usually
with org-mode. For example, we can have 'tag' and 'tag2', both are
recognized by the BOM add-on and can be used in a spreadsheet-like
formula without any confusion. The keywords are also
case-insensitive. 'Component' and 'component' will work in the same
way.
</p>
<p>
The BOM is usually used with a dynamic block. (You can use the
different functions in emacs-lisp code, but this is beyond the
purpose of this tutorial.) Here is the basic dynamic block:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom</span>
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
And here is what we obtain at this point:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom</span>
| Section | Tag | Component | Quantity |
|---------+-----+-----------+----------|
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
The table is empty, because we have to either:
</p><ol>
<li>Add keywords in a table;
</li>
<li>Add a <a href="#sec-7">line-component</a>.
</li>
</ol>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> BOM keywords</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-2-1" class="outline-3">
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> Component</h3>
<div class="outline-text-3" id="text-2-1">
<p>
This is the most important keyword and act as the trigger. For
this example, let's say we write down things we want to buy. In
this case, a new keyboard for our computer. This is how the
table should be:
</p>
<pre class="src src-org"> | | Material |
|<span style="font-weight: bold; font-style: italic;"> ! | Component </span>|
|---+-----------|
| | Keyboard |
</pre>
<p>
The '!' character is used in org table to specify column name, such
as our keyword, 'component'.
And here is what the bill-of-materials for this table is:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom </span>
| Section | Tag | Component | Quantity |
|-----------+-----+-----------+----------|
| Component | | Keyboard | 1 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
As you can see, the heading (Component) was automatically
used as the 'section', which doesn't require attention for
now. The quantity is, unsurprisingly, 1. There is nothing in the tag
column for now, so let's dismiss it by adding the parameter <b>:no-tag t</b>.
This will results in the following:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :no-tag t</span>
| Section | Component | Quantity |
|-----------+-----------+----------|
| Component | Keyboard | 1 |
<span style="color: #586e75; font-style: italic;"> #+END: </span>
</pre>
<p>
Now suppose that our friend too wants a new keyboard.
</p>
<pre class="src src-org"> | | For | Material |
|<span style="font-weight: bold; font-style: italic;"> ! | | Component </span>|
|---+--------+-----------|
| | Me | Keyboard |
| | Friend | Keyboard |
</pre>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :no-tag t</span>
| Section | Component | Quantity |
|-----------+-----------+----------|
| Component | Keyboard | 2 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
As expected, we get 2 keyboards.
</p>
</div>
</div>
<div id="outline-container-2-2" class="outline-3">
<h3 id="sec-2-2"><span class="section-number-3">2.2</span> Section</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The section is used to separate what would otherwise be an
identical component. Suppose we don't want our friend's wishes to be
in the same BOM as our, but still have them in the same table.
</p>
<pre class="src src-org"> | | For | Material |
|<span style="font-weight: bold; font-style: italic;"> ! | Section | Component </span>|
|---+---------+-----------|
| | Me | Keyboard |
| | Friend | Keyboard |
</pre>
<p>
This will results in the following BOM:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :no-tag t</span>
| Section | Component | Quantity |
|---------+-----------+----------|
| Friend | Keyboard | 1 |
| Me | Keyboard | 1 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
Please note that when a component is given a section, it isn't
associated with the heading anymore. As an alternative, you can set
a ':SECTION:' property in the heading, which will be inherited by
all the components <span style="text-decoration:underline;">without</span> a specified section.
Section's priorities are as follow:
</p>
<ol>
<li>Given section with the 'section' keyword;
</li>
<li>The SECTION property;
</li>
<li>The heading.
</li>
</ol>
</div>
</div>
<div id="outline-container-2-3" class="outline-3">
<h3 id="sec-2-3"><span class="section-number-3">2.3</span> Qty</h3>
<div class="outline-text-3" id="text-2-3">
<p>
With this keyword, it is possible to specify a quantity for the
associated component. In our always improving scenario, we now want to
give a keyboard to another of our friend (as a gift). This is going to
be bought at the same time as our keyboard, so they belong together.
</p>
<pre class="src src-org"> | | For | Material | |
|<span style="font-weight: bold; font-style: italic;"> ! | Section | Component | Qty </span>|
|---+---------+-----------+-----|
| | Me | Keyboard | 2 |
| | Friend | Keyboard | 1 |
</pre>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :no-tag t</span>
| Section | Component | Quantity |
|---------+-----------+----------|
| Friend | Keyboard | 1 |
| Me | Keyboard | 2 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
<b>Important</b>: If Qty keyword is present, then any empty field will
be considered as <span style="text-decoration:underline;">zero</span>. This way, multiple column quantity are
made quite easily:
</p>
<pre class="src src-org"> | | For | Material | Personal | Gift |
|<span style="font-weight: bold; font-style: italic;"> ! | Section | Component | Qty | Qty2 </span>|
|---+---------+-----------+----------+------|
| | Me | Keyboard | 1 | 1 |
| | Friend | Keyboard | 1 | |
</pre>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :no-tag t</span>
| Section | Component | Quantity |
|---------+-----------+----------|
| Friend | Keyboard | 1 |
| Me | Keyboard | 2 |
<span style="color: #586e75; font-style: italic;"> #+END: </span>
</pre>
</div>
</div>
<div id="outline-container-2-4" class="outline-3">
<h3 id="sec-2-4"><span class="section-number-3">2.4</span> Tag</h3>
<div class="outline-text-3" id="text-2-4">
<p>
When a BOM starts to get big, we often need a quick reminder of
why we need certain component. Another use is also to identify the
component. As the Qty keyword, multiple Tag columns can be associated
with a single component. Here we will simply use the tag as a reminder
of what we want to look for in the store.
</p>
<pre class="src src-org"> | | For | Material | Personal | Gift | Need |
|<span style="font-weight: bold; font-style: italic;"> ! | Section | Component | Qty | Qty2 | Tag </span>|
|---+---------+-----------+----------+------+--------------------|
| | Me | Keyboard | 1 | 1 | Matching colors |
| | Friend | Keyboard | 1 | | Dinosaurs pictures |
</pre>
<p>
To show the tag column in the BOM, we simply remove the no-tag
parameter.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom</span>
| Section | Tag | Component | Quantity |
|---------+--------------------+-----------+----------|
| Friend | Dinosaurs pictures | Keyboard | 1 |
| Me | Matching colors | Keyboard | 2 |
<span style="color: #586e75; font-style: italic;"> #+END: </span>
</pre>
<p>
If two Tag columns are present for a single Component column, the
tags will be associated with this component, separated by a comma.
</p>
</div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Renaming BOM columns</h2>
<div class="outline-text-2" id="text-3">
<p>
It is possible to rename the BOM columns with the following
parameters:
</p><ul>
<li>col-name-component
</li>
<li>col-name-section
</li>
<li>col-name-quantity
</li>
<li>col-name-tag
</li>
<li>col-name-description
</li>
<li>col-name-price
</li>
</ul>
<p>
This is how our renamed BOM would look like:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :col-name-section For :col-name-tag Need :col-name-component Stuff :col-name-quantity Qty</span>
| For | Need | Stuff | Qty |
|--------+--------------------+----------+-----|
| Friend | Dinosaurs pictures | Keyboard | 1 |
| Me | Matching colors | Keyboard | 2 |
<span style="color: #586e75; font-style: italic;"> #+END: </span>
</pre>
</div>
</div>
<div id="outline-container-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Multiple component's column</h2>
<div class="outline-text-2" id="text-4">
<p>
There is two way to add components in a section. Either by adding
other rows with the same section's name, or by adding other
columns. Both have their uses and they should come to you quite
naturally. In our example, we want more stuff.
</p>
<pre class="src src-org"> | | For | Material | Personal | Gift | Need | Stuff | More stuff | Much more stuff | How many |
|<span style="font-weight: bold; font-style: italic;"> ! | Section | Component | Qty | Qty2 | Tag | Component | Component | Component | Qty </span>|
|---+---------+-----------+----------+------+--------------------+-----------+------------+-----------------+----------|
| | Me | Keyboard | 1 | 1 | Matching colors | Mouse | Headset | USB flash drive | 23 |
| | Friend | Keyboard | 1 | | Dinosaurs pictures | | | | |
| | Friend | | | | | | | CDs | 50 |
| | Friend | Mouse | 1 | | | | | | |
</pre>
<p>
This is beginning to get interesting. Note that even if we can
name the additional columns 'Component2' or 'ComponentAAA',
there's no use to do it if no table-formula uses the column
names.
</p>
</div>
</div>
<div id="outline-container-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> Precise section selection</h2>
<div class="outline-text-2" id="text-5">
<p> Now suppose we want to get OUR to-buy list. Simply specify
the section's parameter <b>:section Me</b>:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :section Me</span>
| Tag | Component | Quantity |
|-----------------+-----------------+----------|
| | Headset | 1 |
| Matching colors | Keyboard | 2 |
| | Mouse | 1 |
| | USB flash drive | 23 |
<span style="color: #586e75; font-style: italic;"> #+END: </span>
</pre>
<p>
Wait, where's the section column? Well we don't need it anymore,
as we specified one.
</p>
<p>
A '+' sign will specify we want more than a single section. <b>:section Me+Friend</b> will select both section, and add the quantity and tags
for each component.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :section Me+Friend</span>
| Tag | Component | Quantity |
|-------------------------------------+-----------------+----------|
| | CDs | 50 |
| | Headset | 1 |
| Dinosaurs pictures, Matching colors | Keyboard | 3 |
| | Mouse | 2 |
| | USB flash drive | 23 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
<b>Do not</b> put a whitespace between the section name and the '+' sign.
Speaking of whitespace, if you need one in a section name, simply
put it in a string:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :section "Section with whitespace"</span>
</pre>
<p>
We can also return every section that matches at least what we
provide. To activate this, use <b>:part-match t</b>. With this, if we
write "fr", the Friend section is returned. If we had another
section named "Frosting", than Friend and Frosting would have been
merged and we would have a total for both section.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :section fr :part-match t</span>
| Tag | Component | Quantity |
|--------------------+-----------+----------|
| | CDs | 50 |
| Dinosaurs pictures | Keyboard | 1 |
| | Mouse | 1 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
It is also possible to specify that we don't want any section
containing "fr". For this, use the parameter <b>:remove t</b>.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :section fr :part-match t :remove t</span>
| Tag | Component | Quantity |
|-----------------+-----------------+----------|
| | Headset | 1 |
| Matching colors | Keyboard | 2 |
| | Mouse | 1 |
| | USB flash drive | 23 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
In this case, getting all sections not containing "fr" is the
equivalent of choosing the section "Me".
</p>
<p>
If you simply want the components from the current heading, use the
parameter <b>:local-only t</b>. This will return components with the
current heading as their section, which is the default of every
component if no section is provided. If a section has been provided to
a component (and is not exactly equal to the heading), the component
will not be returned.
</p>
<p>
Here, we don't have any component under this heading:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :local-only t</span>
| Tag | Component | Quantity |
|-----+-----------+----------|
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
</div>
</div>
<div id="outline-container-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> BOM total</h2>
<div class="outline-text-2" id="text-6">
<p> This is all really interesting, but when we're in a shop, we want
to know how many of each item we have to buy, we need a <b>total</b>.
For this, simply add the <b>:total t</b> parameter. We will also remove
the tags once again by using <b>:no-tag t</b>.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :total t :no-tag t</span>
| Component | Quantity |
|-----------------+----------|
| CDs | 50 |
| Headset | 1 |
| Keyboard | 3 |
| Mouse | 2 |
| USB flash drive | 23 |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
This is the equivalent of merging every sections together.
</p></div>
</div>
<div id="outline-container-7" class="outline-2">
<h2 id="sec-7"><span class="section-number-2">7</span> Adding a component without a table</h2>
<div class="outline-text-2" id="text-7">
<p>
There is another option you might need. If you ever want to
add a component without a table, use the <code>#+BOM</code> commentary. As any
other org-mode commentary, this one won't appear when exported to
another document (pdf, html, docbook..). It will, however, enable
you to add a single component in the bill-of-materials. Here is an
example:
</p>
<pre class="src src-org"> #+BOM: Keyboard :section Need :tag "Matching colors"
</pre>
<p>
As with the table components, you can simply give a component name if
you desire. If no section is given, it will be inherited as an
ordinary component in a table: a section property or the current
heading.
</p>
</div>
</div>
<div id="outline-container-8" class="outline-2">
<h2 id="sec-8"><span class="section-number-2">8</span> Moving components to another section</h2>
<div class="outline-text-2" id="text-8">
<p> The way of associating components to sections by using the table,
properties or headings is quick, but can lack some required
precision. If there's a component you want to move to another
section, use the <b>#+BOM-XFER</b> commentary.
</p>
<pre class="src src-org"> #+BOM-XFER: CDs :TO-SECTION new-section :EVERYTHING t
</pre>
<p>
Everything before the keys <b>:FROM-SECTION</b>, <b>:TO-SECTION</b>,
<b>:PART-MATCH</b> and <b>:EVERYTHING</b> is considered to be the component's
name, except the last whitespaces. The only required key is the
<b>:TO-SECTION</b>. It specifies in which section the component must be
sent. Unless <b>:FROM-SECTION</b> is provided, the section from which to
transfer the components will be following the usual rules in
ORG-BOM. A <b>:PART-MATCH</b> argument can be provided. To disregard the
<b>:FROM-SECTION</b> altogether and simply take every instance of a
component in the entire database, provide <b>:EVERYTHING</b> non-nil."
</p>
</div>
</div>
<div id="outline-container-9" class="outline-2">
<h2 id="sec-9"><span class="section-number-2">9</span> Adding details</h2>
<div class="outline-text-2" id="text-9">
<p> There is two way to add details to a BOM. The first one is to setq
`org-bom-details' with a plist containing, depending on your
needs, :description, :datasheetPdf and :price. You must, however, at
least have the component name in the :name property. Here is an
example on how to set this variable:
</p>
<pre class="src src-emacs-lisp">(setq org-bom-details '((<span style="color: #859900;">:name</span> <span style="color: #2aa198;">"Keyboard"</span> <span style="color: #859900;">:description</span>
<span style="color: #2aa198;">"Something"</span> <span style="color: #859900;">:price</span> <span style="color: #2aa198;">"40"</span>)
(<span style="color: #859900;">:name</span> <span style="color: #2aa198;">"CDs"</span> <span style="color: #859900;">:description</span> <span style="color: #2aa198;">"Not</span>
<span style="color: #2aa198;"> DVDs"</span> <span style="color: #859900;">:datasheetPdf</span> <span style="color: #2aa198;">"CD.pdf"</span>)))
</pre>
<p>
Please note that the price is a <b>string</b>.
</p>
<p>
The other method, valid for the current buffer only, is to give one
or more bom-details table. It is recognized when a table is named as
such:
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+TBLNAME: bom-details</span>
</pre>
<p>
Once again, the column names are used. Contrary to the normal BOM
keywords however, these are case-sensitive and must be written
exactly as their property name. For example, the column of the
property ':name' must be 'name'.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+TBLNAME: bom-details</span>
|<span style="font-weight: bold; font-style: italic;"> ! | name | description | datasheetPdf | price </span>|
|---+----------+--------------+------------------+-------|
| | Keyboard | Used to type | | 40 |
| | CDs | Burn it! | CD-datasheet.pdf | |
</pre>
<p>
Any bom-details table will temporarily overshadow the
`org-bom-details' variable, but won't erase or modify it. This means
you can safely use a bom-details table if you need to change some
local buffer description, while using `org-bom-details' in multiple
buffer.
</p>
<p>
Look at the CDs description. When a field is empty, it is <b>not</b> used
and BOM falls back to the property in the `org-bom-details'
variable.
</p>
</div>
<div id="outline-container-9-1" class="outline-3">
<h3 id="sec-9-1"><span class="section-number-3">9.1</span> Description</h3>
<div class="outline-text-3" id="text-9-1">
<p>
You can add a description column in a BOM by adding the
<b>:description t</b> parameter.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :total t :no-tag t :description t</span>
| Component | Quantity | Description |
|-----------------+----------+--------------|
| CDs | 50 | Not DVDs |
| Headset | 1 | N/A |
| Keyboard | 3 | Used to type |
| Mouse | 2 | N/A |
| USB flash drive | 23 | N/A |
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
See how the CDs' description wasn't the empty field from the
bom-details table.
</p>
</div>
</div>
<div id="outline-container-9-2" class="outline-3">
<h3 id="sec-9-2"><span class="section-number-3">9.2</span> Price</h3>
<div class="outline-text-3" id="text-9-2">
<p>
You can add a price column in a BOM by adding the <b>:price t</b>
parameter.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom :total t :no-tag t :description t :price t</span>
| Component | Quantity | Price | Description |
|-----------------+----------+-------+--------------|
| CDs | 50 | | Not DVDs |
| Headset | 1 | | N/A |
| Keyboard | 3 | 120 | Used to type |
| Mouse | 2 | | N/A |
| USB flash drive | 23 | | N/A |
|-----------------+----------+-------+--------------|
| TOTAL: | | 120 | |
<span style="color: #586e75; font-style: italic;"> #+TBLFM: @&gt;$3=vsum(@I..@&gt;&gt;)</span>
<span style="color: #586e75; font-style: italic;"> #+END:</span>
</pre>
<p>
The price is automatically multiplied by the quantity of each
component. In addition, a total row is added at the table's bottom
with a vertical sum formula.
</p>
</div>
</div>
<div id="outline-container-9-3" class="outline-3">
<h3 id="sec-9-3"><span class="section-number-3">9.3</span> Datasheet</h3>
<div class="outline-text-3" id="text-9-3">
<p>
This is a special property and must be used only if you intend to
export in a pdf document. See <a href="#sec-11-2">LaTeX mode and bom-datasheet</a> for more details.
</p>
</div>
</div>
</div>
<div id="outline-container-10" class="outline-2">
<h2 id="sec-10"><span class="section-number-2">10</span> List of BOM parameters</h2>
<div class="outline-text-2" id="text-10">
<p> Here is a list of all the parameters usable in a BOM dynamic block,
as seen throughout this tutorial:
</p>
<dl>
<dt>no-tag</dt><dd>Remove the tags column
</dd>
<dt>section</dt><dd>Select this section (or more if there's a + sign)
</dd>
<dt>part-match</dt><dd>Select every section with at least the string
provided for the section parameter
</dd>
<dt>remove</dt><dd>Select every sections except the one(s) provided
</dd>
<dt>descripton</dt><dd>Add the description column
</dd>
<dt>price</dt><dd>Add the price column and a total row at the bottom of the
table
</dd>
<dt>col-name-***</dt><dd>Rename the associated column
</dd>
</dl>
</div>
</div>
<div id="outline-container-11" class="outline-2">
<h2 id="sec-11"><span class="section-number-2">11</span> Advanced and elisp functions</h2>
<div class="outline-text-2" id="text-11">
</div>
<div id="outline-container-11-1" class="outline-3">
<h3 id="sec-11-1"><span class="section-number-3">11.1</span> Speed up updates</h3>
<div class="outline-text-3" id="text-11-1">
<p> Each BOM dynamic block scans the entire buffer individually. While
it is necessary that each block be able to update itself, it
becomes a waste when the command `org-update-all-dblocks' is
used. (The components usually aren't changing from a dblock evaluation to
another.)
</p>
<p>
In order to speed up updates, there's a variable that can be used
to stop each BOM dblock from doing a buffer-wide scan. To disable the
scans, set `org-bom-update-enable' to nil.
</p>
<p>
The author uses a function similar to this one to speed up updates:
</p>
<pre class="src src-emacs-lisp">(<span style="color: #859900;">defun</span> <span style="color: #268bd2;">reg-update-project</span> (<span style="color: #b58900;">&amp;optional</span> latex-mode)
<span style="color: #2aa198;">"Update every table and dynamic block in the buffer. If latex-mode</span>
<span style="color: #2aa198;">is non-nil, various latex commands will be inserted."</span>
(interactive)
(org-table-iterate-buffer-tables)
(org-bom-total)<span style="color: #586e75; font-style: italic;">; </span><span style="color: #586e75; font-style: italic;">manually update the BOM database</span>
(<span style="color: #859900;">let</span> ((org-bom-update-enable nil)
(org-bom-latex-mode t)
(org-bom-details (copy-tree org-bom-details)))<span style="color: #586e75; font-style: italic;">;</span><span style="color: #586e75; font-style: italic;">so we don't overwrite</span>
(org-bom-check-for-details-table)<span style="color: #586e75; font-style: italic;">; </span><span style="color: #586e75; font-style: italic;">manually update `</span><span style="color: #2aa198; font-style: italic;">org-bom-details</span><span style="color: #586e75; font-style: italic;">'</span>
(org-update-all-dblocks))
(message <span style="color: #2aa198;">"Project updated"</span>))
</pre>
</div>
</div>
<div id="outline-container-11-2" class="outline-3">
<h3 id="sec-11-2"><span class="section-number-3">11.2</span> LaTeX mode and bom-datasheet</h3>
<div class="outline-text-3" id="text-11-2">
<p> This mode isn't fully integrated to org-mode and should be seen as a
hack. It is however useful to the author, which is why it is
explained here.
</p>
<p>
Set the `org-bom-latex-mode' variable to non-nil in order to
activate the latex-mode. If set, all BOM dynamic block will insert
some latex commands.
</p>
<p>
These commands targets:
</p><dl>
<dt>Tags</dt><dd>When there is more tags than `org-bom-latex-max-tags' per
component, the remaining tags are put in a pdf comment.
</dd>
<dt>Component name</dt><dd>If a datasheet exists for the component, its
name will become a link to its datasheet.
</dd>
</dl>
<p>
If you ever activate the LaTeX mode, use the bom-datasheet dynamic
block at the end of your document. The optional parameter
<b>:description t</b> will add a summary of all the components used in
this buffer with their description, just before the datasheets.
</p>
<pre class="src src-org"><span style="color: #586e75; font-style: italic;"> #+BEGIN: bom-datasheet :description t</span>
| Component | Description |
|----------------------------------+--------------|
| \hyperref[CD-datasheet.pdf]{CDs} | Burn it! |
| Headset | N/A |
| Keyboard | Used to type |
| Mouse | N/A |
| USB flash drive | N/A |
<span style="color: #586e75; font-style: italic;"> #+LaTeX:</span> <span style="color: #b3b3b3;">\includepdf[pages=-,landscape=true,addtotoc={1, subsection, 1, CDs,CD-datasheet.pdf}]{/CD-datasheet.pdf}</span>
</pre>
<p>
If you want to put all your datasheets in another directory, simply
configure the <code>org-bom-latex-datasheetPath</code> variable as shown below:
</p>
<pre class="src src-emacs-lisp">(setq org-bom-latex-datasheetPath <span style="color: #2aa198;">"C:\my-precious-datasheets\")</span>
</pre>
</div>
</div>
</div>
</div>
<div id="postamble">
<p class="date">Date: 2012-08-02 14:28:15 EDT</p>
<p class="author">Author: Frozenlock</p>
<p class="creator">Org version 7.8.02 with Emacs version 23</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.