<?xml version="1.0" encoding="utf-8"?>
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" xmlns:q="http://cnx.rice.edu/qml/1.0" id="m9006" module-id="" cnxml-version="0.6">

  <title>The Intermediate CNXML</title>

  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4">
  <!-- WARNING! The 'metadata' section is read only. Do not edit below.
       Changes to the metadata section in the source will not be saved. -->
  <md:content-id>m9006</md:content-id>
  <md:title>The Intermediate CNXML</md:title>
  <md:version>2.22</md:version>
  <md:created>2001/01/29</md:created>
  <md:revised>2009/04/10 14:04:53.585 GMT-5</md:revised>
  <md:authorlist>
    <md:author id="rars">
        <md:firstname>Ricardo</md:firstname>
        <md:othername>Anthony</md:othername>
        <md:surname>Radaelli-Sanchez</md:surname>
        <md:fullname>Ricardo Radaelli-Sanchez</md:fullname>
        <md:email>ricky@alumni.rice.edu</md:email>
    </md:author>
    <md:author id="cnxorg">
        <md:firstname/>
        <md:surname>Connexions</md:surname>
        <md:fullname>Connexions</md:fullname>
        <md:email>cnx@cnx.org</md:email>
    </md:author>
  </md:authorlist>
  <md:maintainerlist>
    <md:maintainer id="cnxorg">
        <md:firstname/>
        <md:surname>Connexions</md:surname>
        <md:fullname>Connexions</md:fullname>
        <md:email>cnx@cnx.org</md:email>
    </md:maintainer>
    <md:maintainer id="selc">
        <md:firstname>Sarah</md:firstname>
        <md:surname>Coppin</md:surname>
        <md:fullname>Sarah Coppin</md:fullname>
        <md:email>coppin@alumni.rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mizar">
        <md:firstname>Christine</md:firstname>
        <md:surname>Donica</md:surname>
        <md:fullname>Christine Donica</md:fullname>
        <md:email>mizar@alumni.rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="brentmh">
        <md:firstname>Brent</md:firstname>
        <md:othername>Michael</md:othername>
        <md:surname>Hendricks</md:surname>
        <md:fullname>Brent Hendricks</md:fullname>
        <md:email>brentmh@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  <md:license href="http://creativecommons.org/licenses/by/1.0"/>
  <md:licensorlist>
    <md:licensor id="rars">
        <md:firstname>Ricardo</md:firstname>
        <md:othername>Anthony</md:othername>
        <md:surname>Radaelli-Sanchez</md:surname>
        <md:fullname>Ricardo Radaelli-Sanchez</md:fullname>
        <md:email>ricky@alumni.rice.edu</md:email>
    </md:licensor>
  </md:licensorlist>
  <md:keywordlist>
    <md:keyword>caption</md:keyword>
    <md:keyword>CNXML</md:keyword>
    <md:keyword>codeblock</md:keyword>
    <md:keyword>codeline</md:keyword>
    <md:keyword>equation</md:keyword>
    <md:keyword>figure</md:keyword>
    <md:keyword>media</md:keyword>
    <md:keyword>section</md:keyword>
    <md:keyword>subfigure</md:keyword>
  </md:keywordlist>
  <md:subjectlist>
    <md:subject>Science and Technology</md:subject>
  </md:subjectlist>
  <md:abstract>This is the second installment of the CNXML language tutorials.  It is designed to give a more comprehensive look at the CNXML tags and explain some more advanced uses of the language.  Includes helpful examples of CNXML tags, extending the module created in The Basic CNXML tutorial.</md:abstract>
  <md:language>en</md:language>
  <!-- WARNING! The 'metadata' section is read only. Do not edit above.
       Changes to the metadata section in the source will not be saved. -->
</metadata>

<content>    
    <section id="example">
      <title>Example</title>
      <para id="examp1">As is often the case in textbooks, authors will include
	examples in the middle of a chapter or section.  For this
	reason CNXML provides a tag that allows an author to include
	examples in a document.  The example tag has a unique
	<code>id</code> attribute and can contain most tags as
	children, the first being an optional <link document="m9000" target-id="name" class="cnxn">title</link>.  For specifics you should
	always consult the <link url="http://cnx.rice.edu/technology/cnxml/0.5/spec">CNXML
	Spec</link>.
      </para>
      <example id="exampexamp">
	<code id="id12034148" display="block">
&lt;example id='tboneexam'&gt;
  &lt;figure id='tbonefig'&gt;
    &lt;title&gt;T-Bone Steak&lt;/title&gt;
     &lt;media id="image-example" display="block" alt="A T-bone Steak."&gt;
       &lt;image type='image/jpg' src='tbone.jpg'/&gt;
     &lt;/media&gt;
  &lt;/figure&gt;
&lt;/example&gt;
	  
	</code>
      </example>
    </section>

    <section id="figure">
      <title>Figure</title>
      <para id="figp1">
	The <code>figure</code> tag provides the structure for
	creating a figure within a document.  They can contain either
	two or more <link target-id="subfigure" class="cnxn">subfigure</link> tags, or
	a single <link target-id="media" class="cnxn">media</link>, <link document="m9007" target-id="table" class="cnxn">table</link>, or <link document="m9007" target-id="code" class="cnxn">code</link> tag.
      </para>
      <para id="figp2">
	The <code>figure</code> tag has two attributes:
	<list id="figlist">
	  <item><code>id</code> - a unique ID, required</item>
	  <item><code>orient</code> - defines how multiple <link target-id="subfigure" class="cnxn">subfigure</link>s are to be displayed.
	  It takes two values, <code>vertical</code> or
	  <code>horizontal</code>, and will default to
	  <code>horizontal</code>.
	  </item>
	</list>
      </para>
      <para id="name">The optional first tag of the <code>figure</code> tag is <link document="m9000" target-id="name" class="cnxn">title</link> which is used to
	title a figure.
      </para>
      <para id="media">The <code>title</code> tag is followed by any of the tags
	listed above; however, the most commonly used tag is media,
	which is used to include any sort of media such as images,
	video, music, or java applets.  The media object tags have two required
	attributes:
	<list id="medialist">
	  <item><code>src</code> - the location of the displayed media</item>
	  <item>
	    <code>mime-type</code> - defines the type of media being
	    displayed, which can be any valid <link url="http://www.ietf.org/rfc/rfc1341.txt?number=1341">MIME</link>
	    type.
	    <list id="MIME"><item>audio - audio/mp3, audio/wav, etc.</item>
	      <item>video - video/qt, video/mov, etc.</item>
	      <item>image - image/png, image/gif, etc.</item>
	      <item>application - application/PostScript,
		application/x-java-applet, etc.</item>
	    </list>
	  </item>
	</list>
      </para>
      <para id="caption">
	The final tag is the optional <code>caption</code> which is
	used to add a small caption to the figure.
      </para>
      <example id="figexamp">
	<code id="id11752890" display="block">
&lt;figure id='tbone'&gt;
  &lt;title&gt;T-Bone Steak&lt;/title&gt;
  &lt;media id="image-example" display="block" alt="A T-bone Steak."&gt;  
     &lt;image mime-type='image/jpeg' src='tbone.jpg'/&gt;
  &lt;/media&gt;
  &lt;caption&gt;
    Upon successful completion of these documents, you should be able
    to grill a steak that looks just as good!
  &lt;/caption&gt;
&lt;/figure&gt;
	  
	</code>
      </example>
    </section>
    
    <section id="subfigure">
      <title>Subfigure</title>
      <para id="subp1">
	The <code>subfigure</code> tag is used when you want to
	include more than one <link target-id="media" class="cnxn">media</link>,
	<link document="m9007" target-id="code" class="cnxn">code</link> or <link document="m9007" target-id="table" class="cnxn">table</link> within the same
	<link target-id="figure" class="cnxn">figure</link>.
      </para>
      <para id="subp2">The usage of the <code>subfigure</code> tag is similar to that
	of <link target-id="figure" class="cnxn">figure</link>.  It has an optional
	<code>id</code> attribute, an optional first child <link document="m9000" target-id="name" class="cnxn">title</link> tag, a single <link target-id="media" class="cnxn">media</link>, <link document="m9007" target-id="code" class="cnxn">code</link> or <link document="m9007" target-id="table" class="cnxn">table</link>, followed by an optional <link target-id="caption" class="cnxn">caption</link>.
      </para>
      <para id="subp3">
	Now the <code>orient</code> attribute for <link target-id="figure" class="cnxn">figure</link> becomes very important.
	<code>orient</code> lets you specify whether the subfigures
	should be displayed side-to-side or one on top of the other.
      </para>
      <example id="subfigexamp">
	<para id="subp4">
	  <code id="id11753086" display="block">
&lt;figure orient='horizontal' id='horfig'&gt;
  &lt;title&gt;Steaks&lt;/title&gt;
  &lt;subfigure id='subfigtbone1'&gt;
    &lt;title&gt;T-Bone&lt;/title&gt;
    &lt;media id="image-example" display="block" alt="A T-bone Steak."&gt;
      &lt;image type='image/jpeg' src='tbone.jpg'/&gt;
    &lt;/media&gt;
  &lt;/subfigure&gt;
  &lt;subfigure id='subfingnystrip1'&gt;
    &lt;title&gt;New York Strip&lt;/title&gt;
    &lt;media id="image-example" display="block" alt="A NY Strip."&gt;
      &lt;image mime-type='image/jpeg' src='ny_strip.gif'/&gt;
    &lt;/media&gt;
  &lt;/subfigure&gt;
  &lt;caption&gt;
      Upon successful completion of these documents, you
      should be able to grill a steak that looks just as good!
  &lt;/caption&gt;
&lt;/figure&gt;
	  
	  </code>
	  Or
	  <code id="id11753108" display="block">
&lt;figure orient='vertical' id='verfig'&gt;
  &lt;title&gt;Steaks&lt;/title&gt;
  &lt;subfigure id='subfigtbone2'&gt;
    &lt;title&gt;T-Bone&lt;/title&gt;
    &lt;media id="image-example" display="block" alt="A T-bone Steak."&gt;
      &lt;image mime-type='image/jpeg' src='tbone.jpg'/&gt;
    &lt;/media&gt;
  &lt;/subfigure&gt;
  &lt;subfigure id='subfig2'&gt;
    &lt;title&gt;New York Strip&lt;/title&gt;
    &lt;media id="image-example" display="block" alt="A NY Strip."&gt;
      &lt;image mime-type='image/jpeg' src='ny_strip.jpg'/&gt;
    &lt;/media&gt;
  &lt;/subfigure&gt;
  &lt;caption&gt;
    Upon successful completion of these documents, you
    should be able to grill a steak that looks just as good!
  &lt;/caption&gt;
&lt;/figure&gt;
	    
	  </code>
	</para>
      </example>
    </section>

    <section id="list">
      <title>List</title>
      <para id="listp1">The <code>list</code> tag is used to make lists.  It has two
	attributes:
	<list id="listlist"><item><code>id</code> - a unique ID, required</item>
	  <item><code>list-type</code> - defines the formatting of the
	  list.  <code>list-type</code> takes the values
	  <code>bulleted</code> (default), <code>enumerated</code>,
	  <code>named-item</code> or <code>inline</code></item>
	</list>
	The <code>list</code> tag has two children: <link target-id="name" class="cnxn">title</link>, which is optional, and
	<code>item</code>, which is where the list information is
	stored.
      </para>
      <example id="listexamp">
	<title>Example List</title>
	<para id="reglist">
	  <code id="id12787143" display="block">
&lt;list id='marinade' list-type='enumerated'&gt;
  &lt;title&gt;Beer Marinade&lt;/title&gt;
  &lt;item&gt;pour beer into large bowl&lt;/item&gt;
  &lt;item&gt;add chili powder to taste&lt;/item&gt;
  &lt;item&gt;squeeze half lime into beer marinade&lt;/item&gt;
  &lt;item&gt;place steak in beer, let soak for 30 minutes&lt;/item&gt;
&lt;/list&gt;
	    
	  </code>
	  The resulting list will look like:
	  <list id="marinadedisplay" list-type="enumerated">
	    <title>Beer Marinade</title>
	    <item>pour beer into large bowl</item>
	    <item>add chili powder to taste</item>
	    <item>squeeze half lime into beer marinade</item>
	    <item>place steak in beer, let soak for 30 minutes</item>
	  </list>
	</para>
      </example>

      <example id="namedlistexample"><title>New List Types Example</title><para id="namedpara">CNXML 0.6 gives you much more control over the list environment. Now you will be able to choose from eight preset bullet styles as well as an option that allows you to choose your own literal text to serve as the bullet style. The enumerated list type now offers several styles, including Arabic numerals, upper and lower case alphabet characters, and also upper and lower case Roman numerals. In addition to these changes, you can now also select to have your lists follow a stepwise progression. In CNXML 0.6 the named-item list has been slightly altered, and is now called a labeled-item list. As you may have guessed, the change is quite intuitive. Instead of using &lt;name&gt; to specify the item's label, you use &lt;label&gt;.
	  </para><para id="element-546">Here is an example of a stepwise enumerate list:
  <code id="id12787250" display="block">
&lt;list id="eip-165" list-type="enumerated" number-style="arabic" class="stepwise"&gt;
&lt;title&gt;Beer Marinade&lt;/title&gt;
&lt;item&gt;pour beer into large bowl&lt;/item&gt;
&lt;item&gt;add chili powder to taste&lt;/item&gt;
&lt;item&gt;squeeze half lime into beer marinade&lt;/item&gt;
&lt;item&gt;place steak in beer, let soak for	30 minutes&lt;/item&gt;
&lt;/list&gt;
	      
	    </code>
	    The resulting list will look like:
	    <list id="marinade" list-type="labeled-item">
	      <title>Beer Marinade</title>
	      <item><label>Step 1</label>pour beer into large bowl</item>
	      <item><label>Step 2</label>add chili powder to taste</item>
	      <item><label>Step 3</label>
		squeeze half lime into beer marinade</item>
	      <item><label>Step 4</label>
		place steak in beer, let soak for
		30 minutes
	      </item>
	    </list>
	  </para>
	
	
      </example>
    </section>
    
    <section id="equation">
      <title>Equation</title>
      <para id="eqnp1a">The <code>equation</code> tag is used to set off and number
	equations in CNXML documents by using ASCII text, MathML and embedded
	<link target-id="media" class="cnxn">media</link> to display math.  <note id="id11879679" type="note">It is strongly encouraged, however, to use
	equation with <link document="m9008" class="cnxn">MathML</link> tags when
	displaying math.</note>
      </para>

      <section id="nonmathml">
	<title>ASCII Text and Images</title>
	<para id="eqnp2">The first child of equation is an optional <link document="m9000" target-id="name" class="cnxn">title</link> followed by any number of <link target-id="media" class="cnxn">media</link> tags.
	</para>
	<example id="equationexample">
	  <para id="eqnpara"><code id="id11879750" display="block">
&lt;equation id="eqn14"&gt;
  &lt;title&gt;Euler's Relation&lt;/title&gt;
  &lt;media id="equation-example" display="block" alt="Euler's Relation."&gt;
     &lt;image mime-type='image/gif' src='euler.gif' /&gt;
  &lt;/media&gt;
&lt;/equation&gt;
	    
	    </code>
	    <code id="id11879757" display="block">
&lt;equation id='eqn15'&gt;
  &lt;title&gt;Simple Arithmetic&lt;/title&gt;
    11+27=38
&lt;/equation&gt;
	    
	    </code>
	    This equation will display as: 
	    <equation id="eqn15">
	      <title>Simple Arithmetic</title>
	      11+27=38
	    </equation>
	  You could also write this equation using MathML:
<code id="id11879788" display="block">
&lt;equation id="eqn22"&gt;
&lt;m:math&gt;
   &lt;m:mn&gt;11&lt;/m:mn&gt;
   &lt;m:mo&gt;+&lt;/m:mo&gt;
   &lt;m:mn&gt;27&lt;/m:mn&gt;
   &lt;m:mo&gt;=&lt;/m:mo&gt;
   &lt;m:mn&gt;38&lt;/m:mn&gt;
&lt;/m:math&gt;
&lt;/equation&gt;

</code></para>
	</example>
      </section>
    </section>

    <section id="definition">
      <title>Definition</title>
      <para id="defp1">
	The <code>definition</code> tag is used to define a word in a
	CNXML document.  It has a required <code>id</code> attribute
	and three children: <link document="m9000" target-id="term" class="cnxn">term</link>, <code>meaning</code> and <link target-id="example" class="cnxn">example</link>.  How to use definition is a
	little confusing, so don't forget to check out <link target-id="definitionexamp" class="cnxn"/>.
      </para>
      <para id="defp2">The first child tag should be <link document="m9000" target-id="term" class="cnxn">term</link> which contains the word/phrase
	being defined.  It is then followed by a <code>meaning</code>
	tag which is followed by any number of <link target-id="example" class="cnxn">example</link>s.  This process repeats for
	all meanings.
      </para>
      <example id="definitionexamp">
	<code id="id11879914" display="block">
&lt;definition id='tbonedef'&gt;
  &lt;term&gt;T-Bone&lt;/term&gt;
  &lt;meaning&gt;
    "The T-bone steak is cut between 1 and 3 inches thick and comes
     from the center section of the short loin. This steak is
     characterized by its T-shape bone, has a fine-grained shell and a
     small tenderloin eye,"
     &lt;cite&gt;http://www.chophousecalgary.com/steak.html&lt;/cite&gt;.
  &lt;/meaning&gt;
  &lt;example id='tboneexam'&gt;
    &lt;figure id='tbonefig'&gt;
      &lt;title&gt;T-Bone Steak&lt;/title&gt;
        &lt;media id="image-example" display="block" alt="A T-bone Steak."&gt;
          &lt;image mime-type='image/jpeg' src='tbone.jpg'/&gt;
        &lt;/media&gt;
      &lt;/media&gt;
    &lt;/figure&gt;
  &lt;/example&gt;
&lt;/definition&gt;
	  
	</code>
	<para id="defpara">
	  <definition id="tbonedef">
	    <term>T-Bone</term>
	    <meaning id="id11879956">
	      "The T-bone steak is cut between 1 and 3 inches thick
	      and comes from the center section of the short
	      loin. This steak is characterized by its T-shape bone,
	      has a fine-grained shell and a small tenderloin eye,"
	      <cite><cite-title>http://www.chophousecalgary.com/steak.html</cite-title></cite>.
	    </meaning>
	    <example id="tboneexam">
	      <figure id="tbonefig">
		<title>T-Bone Steak</title>
		<media id="id11879996" alt=""><image src="tbone.jpg" mime-type="image/jpeg"/></media>
	      </figure>
	    </example>
	  </definition>
	</para>
      </example>
    </section>

    <section id="rule">
      <title>Rule</title>
      <para id="rule_par1">The <code>rule</code> tag is used to insert a rule, such as a
	theorem, axiom, or rule of thumb, into a cnxml document.  It
	has two attributes:
	<list id="rulelist">
	  <item><code>id</code> - required, unique ID</item>
	  <item><code>type</code> - required, specificies the type of
	  rule (e.g. theorem, axiom, rule of thumb, etc.)
	  </item>
	</list>
	It may also have an optional <link document="m9000" target-id="name" class="cnxn">title</link> and it must have one or more
	<link target-id="statement" class="cnxn">statement</link> tags and zero or
	more <link target-id="proof" class="cnxn">proof</link> or <link target-id="example" class="cnxn">example</link> tags.
      </para>

      <section id="statement">
	<title>Statement</title>
	<para id="state_p1">
	  The <code>statement</code> tag is used inside a
	  <code>rule</code> tag and defines the statement of
	  the rule.  It has an optional <code>id</code> attribute,
	  which, like all IDs, must be unique.  It also has two
	  children, <link document="m9000" target-id="para" class="cnxn">para</link>
	  and <link target-id="equation" class="cnxn">equation</link>.
	</para>
      </section>
      
      <section id="proof">
	<title>Proof</title>
	<para id="proof_p1">
	  The <code>proof</code> tag is used inside the
	  <code>rule</code> tag and marks the proof of the rule.  It
	  has an optional <code>id</code> attribute and may contain
	  another rule, <link document="m9000" target-id="para" class="cnxn">para</link>, <link target-id="equation" class="cnxn">equation</link>, <link target-id="figure" class="cnxn">figure</link>, or <link document="m9000" target-id="list" class="cnxn">list</link> tag.
	</para>
      </section>

      <section id="ruleexmpsec">
	<title>Using rule</title>
	<example id="ruleexmp">
	  <code id="id12080909" display="block">
&lt;rule id='murph' type='law'&gt; 
  &lt;title&gt;Murphy's Law&lt;/title&gt;
  &lt;statement&gt;
    &lt;para id='murphp1'&gt;
      If there are two or more ways to do something, and one of those
      ways can result in a catastrophe, then someone will do it.
    &lt;/para&gt;
  &lt;/statement&gt;
  &lt;proof&gt;
    &lt;para id='murphp2'&gt;
      Edward A. Murphy, Jr. was one of the engineers on the
      rocket-sled experiments that were done by the U.S. Air Force in
      1949 to test human acceleration tolerances (USAF project
      MX981). One experiment involved a set of 16 accelerometers
      mounted to different parts of the subject's body. There were two
      ways each sensor could be glued to its mount, and somebody
      methodically installed all 16 the wrong way around. Murphy then
      made the original form of his pronouncement, which the test
      subject (Major John Paul Stapp) quoted at a news conference a
      few days later
      &lt;cite&gt;http://www.lylemariam.com/murphy.htm&lt;/cite&gt;.
    &lt;/para&gt;
  &lt;/proof&gt;
&lt;/rule&gt;
	    
	  </code>
	  <para id="rulepara">
	    <rule id="murph" type="law"> 
	      <title>Murphy's Law</title>
	      <statement id="id12080960">
		<para id="murphp1">
		  If there are two or more ways to do something, and
		  one of those ways can result in a catastrophe, then
		  someone will do it.
		</para>
	      </statement>
	      <proof id="id12080978">
		<para id="murphp2">
		  Edward A. Murphy, Jr. was one of the engineers on
		  the rocket-sled experiments that were done by the
		  U.S. Air Force in 1949 to test human acceleration
		  tolerances (USAF project MX981). One experiment
		  involved a set of 16 accelerometers mounted to
		  different parts of the subject's body. There were
		  two ways each sensor could be glued to its mount,
		  and somebody methodically installed all 16 the wrong
		  way around. Murphy then made the original form of
		  his pronouncement, which the test subject (Major
		  John Paul Stapp) quoted at a news conference a few
		  days later
		  <cite><cite-title>http://www.lylemariam.com/murphy.htm</cite-title></cite>.
		</para>
	      </proof>
	    </rule>
	  </para>
	</example>
      </section>
    </section>

    <section id="end">
      <title>Finishing Remarks</title>
      <para id="endp1">Thanks for making it through another tutorial.  I'm sure that
	you still want to know more so here's a <link document="m9000" target-id="cnxn" class="cnxn">link</link> to <link document="m9007" class="cnxn">The Advanced CNXML</link>.</para>
    </section>
  </content>
</document>
