<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, "#include" type directive for worksheets?</title>
    <link>http://www.mapleprimes.com/questions/98201-include-Type-Directive-For-Worksheets</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 16:17:21 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 16:17:21 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, "#include" type directive for worksheets?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, "#include" type directive for worksheets?</title>
      <link>http://www.mapleprimes.com/questions/98201-include-Type-Directive-For-Worksheets</link>
    </image>
    <item>
      <title>Use read</title>
      <link>http://www.mapleprimes.com/questions/98201-include-Type-Directive-For-Worksheets?ref=Feed:MaplePrimes:"#include" type directive for worksheets?:Comments#answer98202</link>
      <itunes:summary>&lt;p&gt;The&amp;nbsp;read command&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=read"&gt;?read&lt;/a&gt;&amp;nbsp;&amp;nbsp;provides&amp;nbsp;a simple way to share maple code between worksheets. If the base model is exported to a Maple Input file (.mpl) it can be read into other worksheets by a call to read.&amp;nbsp;&amp;nbsp;To export the base model, open the base model worksheet and from the menu system select File-&amp;gt;Export As. &amp;nbsp;This will open the "Export As" dialog box. &amp;nbsp;Choose "Maple Input (.mpl)" from the "Files of type" menu and save with an appropriate filename. &amp;nbsp;A call to 'read &amp;lt;filename&amp;gt;;' in the other worksheets will import the base model into those worksheets.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=savelib"&gt;?savelib&lt;/a&gt;&amp;nbsp;&amp;nbsp;or a shared kernel&amp;nbsp; &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=worksheet/reference/kernelmodes"&gt;?worksheet/reference/kernelmodes&lt;/a&gt;&amp;nbsp;may be alternatives to using read.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;Duncan&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;The&amp;nbsp;read command&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=read"&gt;?read&lt;/a&gt;&amp;nbsp;&amp;nbsp;provides&amp;nbsp;a simple way to share maple code between worksheets. If the base model is exported to a Maple Input file (.mpl) it can be read into other worksheets by a call to read.&amp;nbsp;&amp;nbsp;To export the base model, open the base model worksheet and from the menu system select File-&amp;gt;Export As. &amp;nbsp;This will open the "Export As" dialog box. &amp;nbsp;Choose "Maple Input (.mpl)" from the "Files of type" menu and save with an appropriate filename. &amp;nbsp;A call to 'read &amp;lt;filename&amp;gt;;' in the other worksheets will import the base model into those worksheets.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=savelib"&gt;?savelib&lt;/a&gt;&amp;nbsp;&amp;nbsp;or a shared kernel&amp;nbsp; &lt;a href="http://www.maplesoft.com/support/help/view.aspx?path=worksheet/reference/kernelmodes"&gt;?worksheet/reference/kernelmodes&lt;/a&gt;&amp;nbsp;may be alternatives to using read.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;Duncan&lt;/p&gt;</description>
      <guid>98202</guid>
      <pubDate>Wed, 27 Oct 2010 19:25:02 Z</pubDate>
      <itunes:author>DuncanA</itunes:author>
      <author>DuncanA</author>
    </item>
    <item>
      <title>Library archive, or plaintext</title>
      <link>http://www.mapleprimes.com/questions/98201-include-Type-Directive-For-Worksheets?ref=Feed:MaplePrimes:"#include" type directive for worksheets?:Comments#answer98203</link>
      <itunes:summary>&lt;p&gt;One method for accomplishing these tasks involves saving the various pieces to a .mla Maple Library Archive. Then, in any new session which requires those pieces you would only have to append `libname` with the location of that archive. You wouldn't even need to `read` or `#include` anything, as the saved objects and expressions would just be there -- just as if you'd assigned them in each new session.&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=libname"&gt;?libname&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=savelib"&gt;?savelib&lt;/a&gt; and maybe &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=LibraryTools"&gt;?LibraryTools&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;You  could save your various pieces (to an archive, say) using a particular  worksheet used just for that purpose. If you go this route then take  care to always save to a valid .mla archive and not to individual .m  files. (If no .mla is availables and writable then Maple will emit .m  files when `savelib` is invoked.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;(You can ignore the first line summary of &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=savelib,"&gt;?savelib,&lt;/a&gt; where it says "&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;save a file to a Maple repository" since that's not what it does. That's a documentation bug. What it actually does is save expressions and Maple objects to a repository. The arrangement of the documentation for saving and using Library archives could be better.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;A quite different alternative is to use the `read` command or the $include directive. But that entails having your various pieces be laid out in plaintext source files (usually give filename extension .mpl but that's just a loose convention). See &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=read"&gt;?read&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=include"&gt;?include&lt;/a&gt; for details.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;Some people strongly prefer to always work with source in plaintext files, while some others take pains to avoid it. Which approach is best for you probably depends most on that, and on how you prefer to work with source.&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;One method for accomplishing these tasks involves saving the various pieces to a .mla Maple Library Archive. Then, in any new session which requires those pieces you would only have to append `libname` with the location of that archive. You wouldn't even need to `read` or `#include` anything, as the saved objects and expressions would just be there -- just as if you'd assigned them in each new session.&lt;/p&gt;
&lt;p&gt;See &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=libname"&gt;?libname&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=savelib"&gt;?savelib&lt;/a&gt; and maybe &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=LibraryTools"&gt;?LibraryTools&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;You  could save your various pieces (to an archive, say) using a particular  worksheet used just for that purpose. If you go this route then take  care to always save to a valid .mla archive and not to individual .m  files. (If no .mla is availables and writable then Maple will emit .m  files when `savelib` is invoked.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;(You can ignore the first line summary of &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=savelib,"&gt;?savelib,&lt;/a&gt; where it says "&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;save a file to a Maple repository" since that's not what it does. That's a documentation bug. What it actually does is save expressions and Maple objects to a repository. The arrangement of the documentation for saving and using Library archives could be better.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;A quite different alternative is to use the `read` command or the $include directive. But that entails having your various pieces be laid out in plaintext source files (usually give filename extension .mpl but that's just a loose convention). See &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=read"&gt;?read&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=include"&gt;?include&lt;/a&gt; for details.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;Some people strongly prefer to always work with source in plaintext files, while some others take pains to avoid it. Which approach is best for you probably depends most on that, and on how you prefer to work with source.&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="body viewer"&gt;&lt;span style="color: #000000; font-size: 100%; font-style: normal;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <guid>98203</guid>
      <pubDate>Wed, 27 Oct 2010 19:26:03 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>read, $include, and the GUI</title>
      <link>http://www.mapleprimes.com/questions/98201-include-Type-Directive-For-Worksheets?ref=Feed:MaplePrimes:"#include" type directive for worksheets?:Comments#answer98214</link>
      <itunes:summary>&lt;p&gt;One can now use the &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=read"&gt;read&lt;/a&gt; command from within the Standard GUI. And &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Preprocessor"&gt;$include&lt;/a&gt; directives can be used within the .mpl text source file that gets read.&lt;/p&gt;
&lt;p&gt;This is how I usually lay out the source of more involved modules, where each export or local (proc) gets $include'd from a master .mpl text source file. By using the `read` command on the parent .mpl file I can access the material from within both commandline and Standard graphical Maple interfaces.&lt;/p&gt;
&lt;p&gt;And &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=currentdir"&gt;currentdir&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=kernelopts"&gt;kernelopts(includepath)&lt;/a&gt; can be set programmatically, to give the whole process even more polish.&lt;/p&gt;
&lt;p&gt;I don't care for the new &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/RunWorksheet"&gt;RunWorksheet&lt;/a&gt; command as it can break some of the very useful evaluation rules that actual procedures have. (See &lt;a href="http://www.mapleprimes.com/questions/98111-Question-On-Fsolve#comment98122"&gt;here&lt;/a&gt;, for a simple example of said benefits.) It's not conducive to writing procedures. And it's awkward to set up. And then there is debugging it...&lt;/p&gt;
&lt;p&gt;One bit difference between using plaintext &amp;amp; read versus &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=libname"&gt;libname&lt;/a&gt; &amp;amp; .mla Library archives is that the former may need to do more work if the source file actually does some computation or processing work. If the source file sets up a really big module package, or does other pre-calculation, then one might not want that to be reproduced with every re-read of the source.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;One can now use the &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=read"&gt;read&lt;/a&gt; command from within the Standard GUI. And &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=Preprocessor"&gt;$include&lt;/a&gt; directives can be used within the .mpl text source file that gets read.&lt;/p&gt;
&lt;p&gt;This is how I usually lay out the source of more involved modules, where each export or local (proc) gets $include'd from a master .mpl text source file. By using the `read` command on the parent .mpl file I can access the material from within both commandline and Standard graphical Maple interfaces.&lt;/p&gt;
&lt;p&gt;And &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=currentdir"&gt;currentdir&lt;/a&gt; and &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=kernelopts"&gt;kernelopts(includepath)&lt;/a&gt; can be set programmatically, to give the whole process even more polish.&lt;/p&gt;
&lt;p&gt;I don't care for the new &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=DocumentTools/RunWorksheet"&gt;RunWorksheet&lt;/a&gt; command as it can break some of the very useful evaluation rules that actual procedures have. (See &lt;a href="http://www.mapleprimes.com/questions/98111-Question-On-Fsolve#comment98122"&gt;here&lt;/a&gt;, for a simple example of said benefits.) It's not conducive to writing procedures. And it's awkward to set up. And then there is debugging it...&lt;/p&gt;
&lt;p&gt;One bit difference between using plaintext &amp;amp; read versus &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=libname"&gt;libname&lt;/a&gt; &amp;amp; .mla Library archives is that the former may need to do more work if the source file actually does some computation or processing work. If the source file sets up a really big module package, or does other pre-calculation, then one might not want that to be reproduced with every re-read of the source.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>98214</guid>
      <pubDate>Wed, 27 Oct 2010 23:01:15 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
  </channel>
</rss>