noteでの表の作り方
note書き始めてみて、気になったのが編集メニューとして表がないこと。
ただ作れないわけではないようでいくつかのやり方があるようなので自分用メモとして記載。
表の作り方(まとめ)
調べてみるといくつかのやり方がある模様。
それぞれメリデメありそうだけど、個人的な所管はこんな感じ。
(ちなみにこの表は1の方法)
$$
\begin{array}{l|l:l}
\textbf{\small{方法}} & \textbf{\small{メリット}} & \textbf{\small{デメリット}} \\
\hline \hline
\text{\scriptsize{TeX(KaTeX)}} &
\text{\scriptsize{・noteに直接書くのでnote内完結}} &
\text{\scriptsize{・TeXが人によっては馴染なさそう}} \\
\text{\scriptsize{で書く}} &
\text{\scriptsize{}} &
\text{\scriptsize{・表現が限定される(色付け不可?等)}} \\
\hline
\text{\scriptsize{Gist(GitHub)}} &
\text{\scriptsize{・Markdownが使える}} &
\text{\scriptsize{・外部ツール(GitHub)が必要}} \\
\text{\scriptsize{で埋込み}} &
\text{\scriptsize{ (現状KaTeXより表現多い?)}} &
\text{\scriptsize{・Gist知らなければ覚える必要あり}} \\
\hline
\text{\scriptsize{表計算ソフト}} &
\text{\scriptsize{・使い慣れたツールで表を作れる}} &
\text{\scriptsize{・外部ツールを利用}} \\
\text{\scriptsize{から貼り付け}} &
\text{\scriptsize{ (Excel等)}} &
\text{\scriptsize{・note上は画像表示になる(コピペ不可)}} \\
\hline
\text{\scriptsize{画像を挿入}} &
\text{\scriptsize{・使い慣れたツールで表を作れる}} &
\text{\scriptsize{・外部ツールを利用}} \\
\text{\scriptsize{}} &
\text{\scriptsize{ (なんでもOK)}} &
\text{\scriptsize{・note上は画像表示になる(コピペ不可)}} \\
\hline
\end{array}
$$
個人的なおすすめ度は上から順。
画像挿入は、何も手を加える必要がない分お手軽だけども後から手を加えれないからいったん除外。
表計算ソフト(Excel)は、誰もが慣れ親しんでいるだろうから導入としては一番お手軽な気がする。
ただ画像扱いなので、note上でコピペや検索できないのが難点。
残るはGist経由のMarkdown形式か、KaTeX形式。
汎用性や現状表現が豊かなのはMarkdownっぽい。KaTeX利用できる制限がかなりあるようなので。
但し、MarkdownはGist経由なのが悩みどころなのと、note使ってる意味が薄くなりそう。
どちらが一般的なのかは知りません。Googleの検索結果では、Markdownのほうが上位に多く出てくるからMarkdownのほうが知名度が高い?
ということで、以降それぞれの特徴を簡単に記載。
TeX(KaTex)利用
$$
\begin{array}{c|r:c:l}
\textbf{書式} & \textbf{数字(右寄せ)} & \textbf{日本語(中央)} & \textbf{英字(左寄せ)} \\
\hline
\hline
{未指定} & {123123} & {あいう} & {abcABC} \\
\hdashline
\text{文字列} & \text{123123} & \text{あア亜} & \text{abcABC} \\
\hdashline
\tiny{小字} & \tiny{123123} & \tiny{あア亜} & \tiny{abcABC} \\
\hdashline
\Huge{大字} & \Huge{123123} & \Huge{あア亜} & \Huge{abcABC} \\
\hdashline
\textbf{太字} & \textbf{123123} & \textbf{あア亜} & \textbf{abcABC} \\
\hdashline
\textit{イタリック体} & \textit{123123} & \textit{あア亜} & \textit{abcABC} \\
\hline
\hline
\text{その他} & \underline{下線} & \underline{\underline{二重下線}} & \sout{取り消し線} \\
\bar{} & \overline{上線} & \overline{\overline{二重上線}} & \cfrac{1}{2}、\sqrt{123}、30^{\circ} \\
\hline
\end{array}
$$
TeX自体は、はるか昔論文書くためにLaTeX触ったことあったので知ってはいたけども、ほとんど忘れてるので改めて。
KaTeXはもう少し自由度高いけど、noteではその一部だけ、というか基本的な機能のみの模様。背景色とか文字色使えなさそうな部分だけが残念。
以下簡単な構文。わかりやすいようにちょっと改行多め。
$$
\begin{array}
{c|l:r}
項目1 & 項目2 & 項目3 \\
\hdashline
12 & あいうえお & ABCDE \\
\hline
\end{array}
$$
↓
$$
\begin{array}
{c|l:r}
項目1 & 項目2 & 項目3 \\
\hdashline
12 & あいうえお & ABCDE \\
\hline
\end{array}
$$
最初の2行と後ろの2行は、表を作る固定ルールなので変更する必要なし。
そういうものだと思ってしまえばOK。
重要なのは3, 4, 5行目の内容。
それ以降(6, 7行目)は必要な行数だけ、4, 5行目をコピペして増やすだけ。
それぞれの意味はこんな感じ
■3行目:{}の中に、列や縦罫線を順番に定義。各記号の意味は下記の通り。
$$
\begin{array}{l|l:l}
\footnotesize{\textbf{目的}} & \footnotesize{\textbf{記号}} & \footnotesize{\textbf{意味}} \\ \hline
\scriptsize{文字位置} & \scriptsize{(未指定)} & \scriptsize{左寄せ} \\
{} & \text{\scriptsize{l}} & \scriptsize{左寄せ} \\
{} & \text{\scriptsize{c}} & \scriptsize{中央寄せ} \\
{} & \text{\scriptsize{r}} & \scriptsize{右寄せ} \\
\scriptsize{{罫線}} & {\scriptsize{(未指定)}} & \scriptsize{罫線なし} \\
{} & \text{\scriptsize{l}} & \scriptsize{実線} \\
{} & \text{\scriptsize{:}} & \scriptsize{破線} \\
\end{array}
$$
■4行目:表に表示する内容を & 区切りで記載。最後に // を付ける。
■5行目:横の罫線を定義。各記号の意味は下記の通り
$$
\begin{array}{l|l:l}
\footnotesize{\textbf{目的}} & \footnotesize{\textbf{記号}} & \footnotesize{\textbf{意味}} \\
\hline
\scriptsize{横罫線} & \scriptsize{(未指定)} & \scriptsize{罫線なし} \\
{} & \text{\scriptsize{\textbackslash hdashline}} & \scriptsize{破線} \\
{} & \text{\scriptsize{\textbackslash hline}} & \scriptsize{実践} \\
{} & \text{\scriptsize{\textbackslash hline \textbackslash hline}} & \scriptsize{二重線} \\
\end{array}
$$
後は覚えて置いたら便利そうなのが、文字の書式などで下記。
$$
\begin{array}{l|l:l}
\footnotesize{\textbf{目的}} & \footnotesize{\textbf{記号}} & \footnotesize{\textbf{意味}} \\ \hline
\scriptsize{書体} & \scriptsize{(未指定)} & \scriptsize{数式みたいな形式} \\
{} & \text{\scriptsize{\textbackslash text\{文字\}}} & \scriptsize{普通の文字列} \\
{} & \text{\scriptsize{\textbackslash textbf\{文字\}}} & \scriptsize{太字} \\
{} & \text{\scriptsize{\textbackslash textit\{文字\}}} & \scriptsize{斜体(イタリック体)} \\
\scriptsize{サイズ} & \text{\scriptsize{\textbackslash tiny\{文字\}}} & \scriptsize{最小(5pt位)} \\
{} & \text{\scriptsize{\textbackslash scriptsize\{文字\}}} & \scriptsize{7pt位} \\
{} & \text{\scriptsize{\textbackslash footnotesize\{文字\}}} & \scriptsize{8pt位} \\
{} & \text{\scriptsize{\textbackslash small\{文字\}}} & \scriptsize{9pt位} \\
{} & \text{\scriptsize{\textbackslash normalsize\{文字\} 又は未指定}} & \scriptsize{通常サイズ(10pt位)} \\
{} & \text{\scriptsize{\textbackslash large\{文字\}}} & \scriptsize{12pt位} \\
{} & \text{\scriptsize{\textbackslash Large\{文字\}}} & \scriptsize{14.4pt位} \\
{} & \text{\scriptsize{\textbackslash LARGE\{文字\}}} & \scriptsize{17.28pt位} \\
{} & \text{\scriptsize{\textbackslash huge\{文字\}}} & \scriptsize{20.74pt位} \\
{} & \text{\scriptsize{\textbackslash Huge\{文字\}}} & \scriptsize{最大サイズ(24.88pt位)} \\
\scriptsize{装飾系} & \text{\scriptsize{\textbackslash sout\{文字\}}} & \scriptsize{取り消し線} \\
{} & \text{\scriptsize{\textbackslash underline\{文字\}}} & \scriptsize{下線} \\
{} & \text{\scriptsize{\textbackslash overline\{文字\}}} & \scriptsize{上線} \\
\end{array}
$$
と、ここまで書いたけども今となっては、ChatGPTなりGemini、Bardさんを使えば書き方教えてくれる気がします。
Gist(Markdown)利用
GitHubアカウントはもともと持っていたけども、Gist自体は初利用。Markdownも知ってはいるけども、初めて触ってみた。
埋込という点を除けば、記述になれるのは楽そう。
ファイル単位とはいえ、GitHubで公開設定が必要なのはちょっと引っかかる部分あり。
こちらも使い方メモろうかと思ったけども、背景色とか文字色の換え方が判らず。注釈もGistに飛んでしまうのでほぼ機能してない感じ。
これならTeX利用でいい気がしてきた。
サンプル表の内容であれば、表の下のほうにある「view raw」押すと記述方法、確認できます。
表計算ソフト(Excel)利用
たぶん本当にこれが一番楽な気がする。(ただしPC利用)
Excel表作って、Ctrl+Cでコピー、noteの編集画面に張り付けるだけで完成。
ただやはり画像になっちゃって、表内の文字が検索できないのは許せない。
スプレッドシートでもコピペできれば良いのだけども、単純にコピペしてもテキスト扱いになり、埋込だとリンクになっちゃう模様。

本日はここまで。(時間切れの為、細かい部分はあとから更新予定)
いいなと思ったら応援しよう!
