all repos — NoPaste @ 3e3c433f026c49e04d0efa0f0f39fc688ed32bb1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/stex/index.html (view raw)

  1<!doctype html>
  2
  3<title>CodeMirror: sTeX mode</title>
  4<meta charset="utf-8"/>
  5<link rel=stylesheet href="../../doc/docs.css">
  6
  7<link rel="stylesheet" href="../../lib/codemirror.css">
  8<script src="../../lib/codemirror.js"></script>
  9<script src="stex.js"></script>
 10<style>.CodeMirror {background: #f8f8f8;}</style>
 11<div id=nav>
 12  <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
 13
 14  <ul>
 15    <li><a href="../../index.html">Home</a>
 16    <li><a href="../../doc/manual.html">Manual</a>
 17    <li><a href="https://github.com/codemirror/codemirror">Code</a>
 18  </ul>
 19  <ul>
 20    <li><a href="../index.html">Language modes</a>
 21    <li><a class=active href="#">sTeX</a>
 22  </ul>
 23</div>
 24
 25<article>
 26<h2>sTeX mode</h2>
 27<form><textarea id="code" name="code">
 28\begin{module}[id=bbt-size]
 29\importmodule[balanced-binary-trees]{balanced-binary-trees}
 30\importmodule[\KWARCslides{dmath/en/cardinality}]{cardinality}
 31
 32\begin{frame}
 33  \frametitle{Size Lemma for Balanced Trees}
 34  \begin{itemize}
 35  \item
 36    \begin{assertion}[id=size-lemma,type=lemma] 
 37    Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} 
 38    of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set
 39     $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of
 40    \termref[cd=graphs-intro,name=node]{nodes} at 
 41    \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has
 42    \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$.
 43   \end{assertion}
 44  \item
 45    \begin{sproof}[id=size-lemma-pf,proofend=,for=size-lemma]{via induction over the depth $i$.}
 46      \begin{spfcases}{We have to consider two cases}
 47        \begin{spfcase}{$i=0$}
 48          \begin{spfstep}[display=flow]
 49            then $\livar{V}i=\set{\livar{v}r}$, where $\livar{v}r$ is the root, so
 50            $\eq{\card{\livar{V}0},\card{\set{\livar{v}r}},1,\power20}$.
 51          \end{spfstep}
 52        \end{spfcase}
 53        \begin{spfcase}{$i>0$}
 54          \begin{spfstep}[display=flow]
 55           then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes 
 56           \begin{justification}[method=byIH](IH)\end{justification}
 57          \end{spfstep}
 58          \begin{spfstep}
 59           By the \begin{justification}[method=byDef]definition of a binary
 60              tree\end{justification}, each $\inset{v}{\livar{V}{i-1}}$ is a leaf or has
 61            two children that are at depth $i$.
 62          \end{spfstep}
 63          \begin{spfstep}
 64           As $G$ is \termref[cd=balanced-binary-trees,name=balanced-binary-tree]{balanced} and $\gdepth{G}=n>i$, $\livar{V}{i-1}$ cannot contain
 65            leaves.
 66          \end{spfstep}
 67          \begin{spfstep}[type=conclusion]
 68           Thus $\eq{\card{\livar{V}i},{\atimes[cdot]{2,\card{\livar{V}{i-1}}}},{\atimes[cdot]{2,\power2{i-1}}},\power2i}$.
 69          \end{spfstep}
 70        \end{spfcase}
 71      \end{spfcases}
 72    \end{sproof}
 73  \item 
 74    \begin{assertion}[id=fbbt,type=corollary]	
 75      A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes.
 76    \end{assertion}
 77  \item
 78      \begin{sproof}[for=fbbt,id=fbbt-pf]{}
 79        \begin{spfstep}
 80          Let $\defeq{G}{\tup{V,E}}$ be a fully balanced tree
 81        \end{spfstep}
 82        \begin{spfstep}
 83          Then $\card{V}=\Sumfromto{i}1d{\power2i}= \power2{d+1}-1$.
 84        \end{spfstep}
 85      \end{sproof}
 86    \end{itemize}
 87  \end{frame}
 88\begin{note}
 89  \begin{omtext}[type=conclusion,for=binary-tree]
 90    This shows that balanced binary trees grow in breadth very quickly, a consequence of
 91    this is that they are very shallow (and this compute very fast), which is the essence of
 92    the next result.
 93  \end{omtext}
 94\end{note}
 95\end{module}
 96
 97%%% Local Variables: 
 98%%% mode: LaTeX
 99%%% TeX-master: "all"
100%%% End: \end{document}
101</textarea></form>
102    <script>
103      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
104    </script>
105
106    <p>sTeX mode supports this option:</p>
107    <d1>
108      <dt><code>inMathMode: boolean</code></dt>
109      <dd>Whether to start parsing in math mode (default: <code>false</code>).</dd>
110    </d1>
111
112    <p><strong>MIME types defined:</strong> <code>text/x-stex</code>.</p>
113
114    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#stex_*">normal</a>,  <a href="../../test/index.html#verbose,stex_*">verbose</a>.</p>
115
116  </article>