.. index:: Template ======== Template ======== .. toctree:: :maxdepth: 1 |  テンプレートです.これから記事を追加する際はこのテンプレートを利用することにする. | 日付2014年3月19日に作成 | このような大項目の下には,以下で説明する内容の概要を書こう. ところで普通はコード上で改行しても改行されない. 上記のように改行をさせたい時は,下記のようにするか 一行開けて文章を始める必要がある.が,1行あけると,このように空行が挿入される. | ラインブロックで改行を維持したいときは, | 「| 」を前につける. |  改行がいじされる. .. index:: pair: code; python .. index:: single: scheme; Taro's explicit 説明項目(コードの挿入) =========================== .. toctree:: :maxdepth: 1 |  この項目は具体的な内容を書くことにする. | ここでは,まずは,コードを挿入する方法について書く. | この項目の上にあるように,「.. index:: code」をつけておくと,indexに分類されるようになる. |  以下はpythonのコードを挿入した例である.「.. code-block:: python」に続けてコードを書けばよい. | ブロックの前後の空行とコード部分はタブあるいは空白をいれるのをわすれないように. .. code-block:: python :linenos: :emphasize-lines: 1,2 #this is a sample code of python import this print hello for i in 1000: print i | コンソール画面 .. code-block:: python >>> print ("Hello, world!") Hello, world! .. index:: pair: fortran; code |  以下はfortranコードの挿入 .. code-block:: fortran :linenos: :emphasize-lines: 3,5 !sample code of fortran program main implicit none integer:: i,j,k !-----CPU time call CPU_TIME(start_time) print *,i,j,k end program main ソースコードを丸ごともってくるとき .. literalinclude:: /work_space/read_and_plot.py :language: python :emphasize-lines: 12,15-18 :linenos: :: File "/Users/kentaro/OneDrive/***/sample_code/***.py", line 7 print ('Hello, world!") ^ SyntaxError: EOL while scanning string literal 囲うだけ .. note:: 「:lineos:」で番号をつける 「:emphasize-lines:」で特定の行だけ強調 .. warning:: 警告しなくちゃ .. |caution| image:: ./img/himawari.png :alt: Warning! .. index:: pair: figure; table 第二階層:図,表 --------------------------------- .. image:: ./img/himawari.png :scale: 100 % :alt: alternate text when the image doesn't open .. note:: シンプルな貼付けはimageで .. figure:: ./img/himawari.png :scale: 70% :align: center :alt: Alternate text instead of figure Fig. 1 一行あけてここに書いたものがキャプションになります。 .. note:: 場所は、:align: の後に"left", "center", or "right" キャプションや、場所指定をするときはfigureで .. index:: table 第二階層:表 --------------------------------- +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | ... | ... | | +------------------------+------------+----------+----------+ | .. table:: Table 1 simple table ===== ===== ========== A not A RE ===== ===== ========== False True maru LLLL True False batu ===== ===== ========== | .. list-table:: Table 2 Frozen Delights! :widths: 15 10 30 :header-rows: 1 * - Treat - Quantity - Description * - Albatross - 2.99 - On a stick! * - Crunchy Frog - 1.49 - If we took the bones out, it wouldn't be crunchy, now would it? * - Gannet Ripple - 1.99 - On a stick! .. index:: emphasis 第一階層(強調など) ============================ .. toctree:: :maxdepth: 1 .. index:: 強調 第二階層:イタリック,協調,網掛け,文献タイトル, ----------------------------------------------------------------- | テキストを一部を強調したいとき. | 斜体イタリック *イタリック* でかくときは、スター一つ「*」で挟む。 | スター二つ「**」で挟むと **強調**  | 「``」(二つ)で挟むと, ``!網掛け!`` | 文献タイトル,〔 :title-reference:`ハミルトン力学系のためのシンプレクティック数値積分法`,吉田春夫 〕 | 書籍, 〔 :title-reference:`ストロガッツ 非線形ダイナミクスとカオス`,Steven H. Strogatz,田中久陽ら訳(丸善出版,2015) 〕 | 周囲の文字とスペースなどで区切るのを忘れずに。  .. index:: 特殊文字 第二階層:特殊文字 ----------------------- 下付き&上付き H\ :sub:`2`\ O , E = mc\ :sup:`2` \ 良く使う文字列であれば登録しておくこともできる. 「.. |H2O| replace:: H\ :sub:`2`\ O」 .. |H2O| replace:: H\ :sub:`2`\ O |H2O| .. index:: numbered_list 第二階層:リスト ----------------- 番号付きのリストをつくる 1. hey 2. jue 3. jack #. auto numbering #. auto numbering2 番号なし + いち + にい + さん + しー .. index:: Link 第一階層:リンクをはる. --------------------------------- `>> MDL HP of TUMSAT `_ 「`M**T <http://www**>`_」URLリンクをはる `第二階層:表`_: 同一ページ内リンク :doc:`./research/` Sphinxドキュメント内別ページへのリンク :doc:`./particle_sim/01first_step/` Sphinxドキュメント内別ページへのリンク 私はpythonで使った `>> Spyder <./python/04with_editor.html>`_ Sphinxドキュメント内別ページへのリンク .. note:: 「./」とか「../」とかの階層構造を間違えないように.webにアップしたときに問題が生じる予感がある. その他 ------------------ 文章の途中に「空行」を入れたいときは、 | | .. note:: 空行は「 | 」空行+縦棒+空行 ----------- .. note:: セクションで使える記号を4つ以上並べた行を書くと水平線が引けます。 .. index:: math 数式 ====== Mathjax は数式を表示するための javascriptを用いたディスプレイエンジンです. この Mathjax を使うことで Tex命令でホームページ上にきれいな数式を表示することができます. 等号等 .. math:: <, \lt\, \leq, \geq, \neq, \approx, \times, \pm, \mp, \in, \mathbb{R}, \mathbb{Z}, \mathbb{N} .. math:: \frac{df}{dx} = \lim\limits_{\epsilon \to 0} \frac{f(x+\epsilon)-f(x)}{(x+\epsilon)-(x)} Summation .. math:: \sum \frac{1}{\omega \Omega} .. math:: \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6} integral .. math:: \int_a^b f(x)~dx defferencial .. math:: \frac{dy}{dx}, \frac{\Delta y}{\Delta x} .. math:: W \approx \sum{f(x_k) \Delta x} .. math:: \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a} limit .. math:: \lim\limits_{x \to \infty} f(x) .. math:: H=-\dfrac{\hbar ^{2}}{\,2m\,} \dfrac{d^2}{dx^2}+V(x) 運動方程式 .. math:: m\frac{d^2 x}{dt^2} &= 0 \\ m\frac{d^2 y}{dt^2} &= -mg ベクトルつき運動方程式 .. math:: \frac{d^2 \boldsymbol{x}_i}{dt^2} = \sum_{j \neq i}Gm_j\frac{\boldsymbol{x}_j- \boldsymbol{x}_i}{|\boldsymbol{x}_j-\boldsymbol{x}_i|^3} 単位は立体で書こう. :math:`G = 6.67259 \times 10^{-11} \mathrm{m^3 s^{-2} kg^{-1}}` , :math:`m_s = 1.989 \times 10^{30} \mathrm{kg}` .. math:: :nowrap: \begin{eqnarray} y & = & ax^2 + bx + c \\ f(x) & = & x^2 + 2xy + y^2 + D \end{eqnarray} .. math:: (a + b)^2 = a^2 + 2ab + b^2 (a - b)^2 = a^2 - 2ab + b^2 .. math:: (a + b)^2 &= (a + b)(a + b) \\ &= a^2 + 2ab + b^2 .. math:: f(x) & = & x^2 + 2xy + y^2 縦ベクトル .. math:: \binom{n+1}{2k} デカい括弧 .. math:: \frac{d^2x}{dt^2} = \frac{d}{dt}\left( \frac{a}{T}\frac{dx^*}{dt^*}\right) .. math:: \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\ldots} } } } 式番号(ラベル)をつけるとき .. math:: e^{i\pi} + 1 = 0 :label: euler Euler's identity, equation :eq:`euler`, was elected one of the most beautiful mathematical formulas. .. math:: \sin{x} = x :label: sinusoidal sin function , :eq:`sinusoidal` is also important だよ。 .. math:: \arctan{x}=0.0 .. math:: E &= [y_1-(ax_1+b)]^2 + [y_2-(ax_2+b)]^2 + ...... + [y_n-(ax_n+b)]^2 \\ &= \sum_{i=1}^n [y_i-(ax_i+b)]^2 .. math:: \frac{\partial E}{\partial a} = 0, \frac{\partial E}{\partial b} = 0 .. math:: \frac{\partial E}{\partial a} &= 2[y_1-(ax_1+b)](-x_1) + 2[y_2-(ax_2+b)](-x_2) + ...... + 2[y_n-(ax_n+b)](-x_n) \\ &= -\sum_{i=1}^n 2(y_i-ax_i-b)x_i = 0 .. math:: \frac{\partial E}{\partial b} &= 2[y_1-(ax_1+b)](-1) + 2[y_2-(ax_2+b)](-1) + ...... + 2[y_n-(ax_n+b)](-1) \\ &= -\sum_{i=1}^n 2(y_i-ax_i-b) = 0 数式中に立体文字をいれる場合は,次のAはローマフォント,Bはボルドフォント .. math:: f(x) & = & \mathrm{A} ^2 + 2xy + \mathbf{B} ^2 ギリシャ文字 .. math:: \pi , \epsilon, \phi \Phi, \theta \Theta, \delta, \gamma, \alpha, \beta, \gamma, \delta, \mu, \nabla _i 矢印や時間微分などを上につけるとき .. math:: \frac d{dx}x\dot x = \dot x^2 + x\ddot x .. math:: \hat x , \widehat{xy}, \bar x , \overline{xyz}, \vec x, \overrightarrow{xy} 文章中に数式を埋め込む時は。。。「:math:`\sin{x} = x`」