windowsを最近は使ってますよ

qiita.com

この記事を参考にvscodeでターミナルに遷移できるショートカットを作りました。

エディタからターミナルはAlt+Tに設定 ターミナルからエディタはCtrl+1(画面分割してるときは2でもおk)

あといいvscodeのいいコマンド Ctrl+Tで変数の検索ができる

あと、word、powerpointで数式を簡単に入力したいので、windows用のmathpix sniping toolをいれた Ctrl+Shift+Mで起動できます

最近覚えたのはwindows+Shift+Sで選択スクリーンショット めっちゃつかってる

B3輪講 LaTeXレジュメ

LeTeXについて

まず大前提として、私はあまりLaTaXについて完全に詳しいわけではありません。

個人の主観が結構入ってると思うので、参考にしないほうがいいかもしれませんよ

ちなみに、かなりのサイトを見ましたが、LaTeXは反対派の方が多いし、就職してから使いません

なので、今から習得する必要はないと思います。

ちなみに、参考文献は以下

高専の時の研究室のボスです

hkob.hatenablog.com

大学の研究室の同期にLaTeXを教えるのに使わせていただきました。

Texを使った文書作成の基本などを学んでいこうと思う

基本の文法は少しやるが、基本文法というのは調べれば出てくるので

自分が高専の時に身につけたtexの書き方を教えられればと思う。

ちなみに、この文書はMarkDownで書いてます笑

LaTeXを使うメリット

  • ソースファイルはテキストファイルなので環境によらない
  • ファイルを個別に分けて編集ができる
  • 綺麗な数式(まぁ最近のwordは書けるけどね)
  • 指定されたスタイルファイルを使用すれば、同じ様式の文章が誰でも簡単に記述できる。
  • コマンドが作れる
  • ドラックパッドを使う必要がない
  • そのまま印刷品質のデータも作成できるため、そのまま入稿することができる出版社もある
  • 学会によっては、Latexの方が掲載量が安い場合がある。(でも大体同じ)

f:id:sekigaku1124:20211220001301p:plain

LaTeXを使うデメリット

  • 毎回コンパイルする必要(自動コンパイルはある)
  • ソースを見ても出来上がりの画面が予測しにくい
  • 命令を覚える必要がある

高専の時に作ったレポートや抄録など見てみよう

LaTeXを使ってみよう

このCloudLatexが一番やりやすいかなーと思い

簡単な登録が必要だけど…

cloudlatex.io

サンプルコード

\documentclass[12pt]{jarticle}
\begin{document}

\title{はじめての \LaTeX}
\author{学籍番号 自分の名前}
\date{\today}
\maketitle

\section{はじめに}
これは初めて \LaTeX で書いた文章である。% コマンドの後ろにはスペースを空ける
ソースファイル内で改行しても組版すると繋がる。
このため、行ごとに改行して記述すると行単位での入替が簡単になる。

空行を入れると段落が変わる。また、数式も書くことができる。
\begin{equation}
y = v_0t − \frac{1}{2}gt^2
\end{equation}

\end{document}

サンプルコード2

\RequirePackage{plautopatch}
\RequirePackage[l2tabu, orthodox]{nag}

\documentclass[platex,dvipdfmx]{jlreq}          % for platex
% \documentclass[uplatex,dvipdfmx]{jlreq}       % for uplatex
\usepackage{graphicx}
\usepackage{bxtexlogo}
\usepackage{bm}

\title{レポートタイトル}

\author{学生番号XXX-XXXX アカリク太郎}
\date{\today}
\begin{document}
\maketitle

\section{Cloud LaTeX}
\subsection{テストテスト}
\subsubsection{ここはあまり使わない}
\section*{これは番号なし}

\begin{enumerate}
\item これは箇条書き
\item 番号付きです
\end{enumerate}

\begin{itemize}
\item これは箇条書き
\item 点ですね
\end{itemize}

Aをベクトルで表すと$\bm{A}$となりますね


Cloud LaTeXは,\LaTeX を使った文書の作成・管理をクラウド上で行えるWebサービスです.
\LaTeX を使うと,複雑な数式
を含んだ読みやすくきれいな文書作成ができます.

本サービスは,\LaTeX 文書をリアルタイムに保存・コンパイルし,ユーザーアカウント別に管理します.
そのため,本サービスにログインするだけで,どこからでも作業を再開でき,ファイルを持ち歩く必要はありません.
また,様々な \LaTeX テンプレートが用意されているので,手軽に文書を作り始めることができます.


Cloud LaTeXでは,作成されるPDFそのままのレイアウトで表示するPDFビューモードがあり,コンパイル画面を確認しながら文書を作成することができます
日本語では, \pLaTeX / \upLaTeX / \LuaLaTeX でのコンパイルが可能です.
また,日本語や英語文書作成だけでなく,中国語・ハングルに対応した \XeLaTeX のコンパイルも可能です
ぜひ使ってみてください.
\end{document}

図の貼り付け方

図を貼り付けるには、figure 環境を利用します。 figure はフローティング環境と言われ、LaTeX が適切な場所に配置してくれます。 この例では、top, bottom, page の順に配置場所を候補にします。 論文などでは here の h はあまり使わないのですが、レポートだと段組もなく、上下のスペースがないので、使っても仕方ないかもしれません。 PDF ファイルは \includegraphicsコマンドで挿入します。 この時に[]で図のサイズを指定できます。 また、後で説明する参照のために\labelコマンドでラベルを指定します。

貼り付けてみてください

\begin{figure}[tbp]
\centering
\includegraphics[width=100mm]{figures/Sample.png}
\caption{ここにキャプションを挿入します}
\label{fig:model}
\end{figure}

参照

レポートでは図を配置したら、必ず本文から参照しますよね

以下の文を上らへんに貼り付けてみてください

\newcommand{\wfig}[1]{\ref{fig:#1}}%

本文のどこかに以下を挿入

\wfig{model} は挿入した図である。

表の作り方

表も図と同様にフローティング環境であり、table 環境を利用します。 図と異なり、\captionコマンドは表の上に付けます。 また、表のラベルには「tab:」を付けます。 表の配置については figure と同じです。

\begin{table}[tbp] % 表の環境を開始 (top, bottom, page の順で配置を試みる)
 \centering% 環境をセンタリング
 \caption{作成されたグラフ}% キャプションを記述
 \label{tab:魔法陣}% 図のラベルを設定
 \begin{tabular}{|c|c|c|}\hline
  2 & 9 & 4 \\ \hline
  6 & 1 & 8 \\ \hline
  7 & 5 & 3 \\ \hline
 \end{tabular}
\end{table}% 表の環境を終了

表作る時におすすめのサイト

https://www.tablesgenerator.com/latex_tables

csvやExcel表からのコピペでLaTeXの表に変換します|csv2tabular

コマンドが作れる!

\begin{document}の前に挿入してみてください

\newcommand{\myfig}[4]{
\begin{figure}[#4]
        \centering
        \includegraphics[width=100mm]{#1}
        \caption{#2}
        \label{fig:#3}
\end{figure}}

さっき入れた図を挿入する以下の文を

\begin{figure}[tbp]
\centering
\includegraphics[width=100mm]{figures/Sample.png}
\caption{ここにキャプションを挿入します}
\label{fig:model}
\end{figure}

を消去し

\myfig{figures/Sample.png}{テスト}{model}{tbp}

にしてみてください

以上のように、変数を入力すれば、長いコマンド文も複数回入力しなくて済むんですね

数式の記述

数式の記述はすでに説明している equation 環境を利用します。 もし、数式が複数行にまたがる場合には、最近は align 環境を利用します(以前は、eqnarray 環境がよく使われていましたが最近は使いません)。 こんな感じで記述してください。 数式のラベルには「eq:」を付けます。式が継続していて番号を振りたくない行には \nonumber を記載する。

こちらを上に記入

\usepackage{amsmath}

下の文をコピペ

\begin{align}
   y = \int\left(\int-g dt\right) dt \nonumber \\
   = \int(-gt + C_1)dt \nonumber \\
   = -\frac{1}{2}gt^2 + C_1t + C_2 \label{eq:自由落下運動}
\end{align}

この下の文もコピペ。何が違うでしょう

\begin{align}
   y &= \int\left(\int-g dt\right) dt \nonumber \\
   &= \int(-gt + C_1)dt \nonumber \\
   &= -\frac{1}{2}gt^2 + C_1t + C_2 \label{eq:自由落下運動}
\end{align}

オイラーの公式導出

\begin{equation}
\begin{aligned}
e^{i x} &=\sum_{n=0}^{\infty} \frac{i^{n}}{n !} x^{n} \\
&=\sum_{n=0}^{\infty} \frac{i^{2 n}}{(2 n) !} x^{2 n}+\sum_{n=0}^{\infty} \frac{i^{2 n+1}}{(2 n+1) !} x^{2 n+1} \\
&=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n) !} x^{2 n}+i \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1) !} x^{2 n+1} \\
&=\cos x+i \sin x
\end{aligned}
\end{equation}

LaTeXのコマンド

Latexのコマンド一覧をこちらで確認しましょう Latexはコピペができれば書くことができるのです LaTeX - コマンド一覧

色々やってみましょうのコーナー

ここでまたおすすめのアプリ

macなら以下のコマンドでインストールできますよ

brew install mathpix-snipping-tool --cask

mathpix.com

このアプリで読み取ってみましょう

f:id:sekigaku1124:20211220030212p:plain

まとめ

LaTeXの良いところは少しは理解してもらえたかな?

慣れれば悪いもんでもない気がするんですよ

慣れればね

以上です

hkobのブログを見てやってみたこと

ngspiceをダウンロードしてみよう

なんか自分がやった時より変わってるからダウンロードがめんどくさいらしい

Brewfileってやつがよくわかんないから、自分でできそうなところまでやってみる

brew tap hkob/m1-beta-brew
Cloning into '/usr/local/Homebrew/Library/Taps/hkob/homebrew-m1-beta-brew'...
remote: Enumerating objects:35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 35 (delta 13), reused 21 (delta 3), pack-reused 0
Receiving objects: 100% (35/35), 13.70 KiB | 4.57 MiB/s, done.
Resolving deltas: 100% (13/13), done.
Warning: Calling `cellar` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument instead.
Please report this issue to the hkob/m1-beta-brew tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/hkob/homebrew-m1-beta-brew/openjdk16-arm64.rb:11

warningは出たけど、一応tapはできてるっぽい?

brew install ngspice-x
Error: Your Command Line Tools are too outdated.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.

Error: Your Command Line Tools (CLT) does not support macOS 11.
It is either outdated or was modified.
Please update your Command Line Tools (CLT) or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.

ん、エラー出てしまった

よくわかんないな

とりあえず、これに出てきたやつ実行してみるか

softwareupdate --all --install --force
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

やっても大丈夫なやつだったかはわからない

もう一回インストールしてみよ

brew install ngspice-x
ngspice

できたっぽい?

elctronでアプリを作ってみたい!!

vueのelectronを使ってアプリを作ってみますよ

作るアプリは、classroomのzoomリンク管理アプリ

作ってみよーー

まずvueをcreate

vue create gakku

Vue CLI v4.5.12
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Router, Linter
? Use history mode for router? (Requires proper server setup for index fallback 
in production) Yes
? Pick a linter / formatter config: Prettier
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
? Save this as a preset for future projects? No

eslintの設定が前回適当にやったらできなかったので、とりあえず、前回と同じやつにしてみた

cd gakku/
vue add electron-builder
Choose Electron Version ^11.0.0

vueでelectronをやってみよう

どうもがくです

今日はelectronをいじってみたくなったのでいじってみます

yarn global add @vue/cli
vue create vue-electron-boilerplate
? Please pick a preset: Default (Vue 3 Preview)

一応createまではできた

cd vue-electron-boilerplate
vue add electron-builder
? Choose Electron Version (Use arrow keys)
❯ ^11.0.0 

バージョンがよくわかんなかったから、とりあえず一番新しいの

yarn electron:serve

お、アプリが立ち上がった! これはいけそう

今eslintで自動整形をやろうと思ってるんだけど全然できない笑

まぁ明日やりましょうー

vueをいじってcssもやってまーす

今日は、bootstraapをいじってみたー!!!

bootstrapのサイトでダウンロードした!! 今回使ったのは、bootstrap-4.5.2-distってやつだけだったかなー あとは、yarn add bootstrapで入れた

このファイルの中の、cssとjsってファイルをpublicの中に移動した!!

index.htmlを書き換えた!!

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

参考にしたサイト デザイン知識がなくてもOK!Bootstrapの使い方【入門者向け】 | TechAcademyマガジン

about.vueをいろいろと変更

<template>
  <div class="container">
    <div class="table-responsive">
      <table class="table table-bordered">
        <thead>
          <tr>
            <th>#</th>
            <th>名前</th>
            <th>メールアドレス</th>
            <th>電話番号</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">1</th>
            <td>煌木 太郎</td>
            <td>taro.kirameki@example.com</td>
            <td>09011112222</td>
          </tr>
          <tr>
            <th scope="row">2</th>
            <td>煌木 次郎</td>
            <td>jiro.kirameki@example.com</td>
            <td>09033334444</td>
          </tr>
          <tr>
            <th scope="row">3</th>
            <td>煌木 花子</td>
            <td>hanako.kirameki@example.com</td>
            <td>09055556666</td>
          </tr>
        </tbody>
      </table>
    </div>
    <button type="button" class="btn btn-default">Default</button>
    <button type="button" class="btn btn-primary">Primary</button>
    <button type="button" class="btn btn-success">Success</button>
    <button type="button" class="btn btn-info">Info</button>
    <button type="button" class="btn btn-warning">Warning</button>
    <button type="button" class="btn btn-danger">Danger</button>
    <button type="button" class="btn btn-link">Link</button>
    <p>
      <button type="button" class="btn btn-primary btn-lg">Large button</button>
      <button type="button" class="btn btn-default btn-lg">Large button</button>
    </p>
    <p>
      <button type="button" class="btn btn-primary">Default button</button>
      <button type="button" class="btn btn-default">Default button</button>
    </p>
    <p>
      <button type="button" class="btn btn-primary btn-sm">Small button</button>
      <button type="button" class="btn btn-default btn-sm">Small button</button>
    </p>
    <p>
      <button type="button" class="btn btn-primary btn-xs">
        Extra small button
      </button>
      <button type="button" class="btn btn-default btn-xs">
        Extra small button
      </button>
    </p>
    <form>
      <div class="form-group">
        <label for="exampleInputEmail1">Email address</label>
        <input
          type="email"
          class="form-control"
          id="exampleInputEmail1"
          placeholder="Email"
        />
      </div>
      <div class="form-group">
        <label for="exampleInputPassword1">Password</label>
        <input
          type="password"
          class="form-control"
          id="exampleInputPassword1"
          placeholder="Password"
        />
      </div>
      <div class="form-group">
        <label for="exampleInputFile">File input</label>
        <input type="file" id="exampleInputFile" />
        <p class="help-block">Example block-level help text here.</p>
      </div>
      <div class="checkbox">
        <label> <input type="checkbox" /> Check me out </label>
      </div>
      <button type="submit" class="btn btn-default">Submit</button>
    </form>
  </div>
</template>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
export default {
  methods: {
    showEl: function() {
      console.log(this.$el);
    }
  }
};
</script>

Macにtexを入れる!!

macbookproになったので、texをもう一回入れていく

参考にしたページ

LaTeX 環境の構築(macOS) - BYOD PC のセッティング(5) - hkob’s blog

brew cask install mactex-no-gui

tlmgrってコマンド使わないといけないけど、使えないっぽい pathを通さないとなんだね

sudo /usr/local/texlive/2020/bin/x86_64-darwin/tlmgr path add
sudo tlmgr update --self --all
sudo tlmgr paper a4
sudo tlmgr repository add http://contrib.texlive.info/current tlcontrib
sudo tlmgr pinning add tlcontrib '*'
sudo tlmgr install japanese-otf-nonfree japanese-otf-uptex-nonfree ptex-fontmaps-macos cjk-gs-integrate-macos
sudo tlmgr path add
sudo cjk-gs-integrate --link-texmf --cleanup
sudo cjk-gs-integrate-macos --link-texmf
sudo kanji-config-updmap-sys --jis2004 hiragino-highsierra-pron

ターミナルに以下を記入

code ~/.latexmkrc

まぁ普通にlatexmkrcっていう最初の読み込みファイル作っただけ

.latexmkrcに以下を記入

#!/usr/bin/env perl

## latex commands
$latex            = 'platex -synctex=1 -halt-on-error';
$latex_silent     = 'platex -synctex=1 -halt-on-error -interaction=batchmode';
$bibtex           = 'pbibtex -kanji=utf8';
$dvipdf           = 'dvipdfmx %O -o %D %S';
$makeindex        = 'mendex %O -o %D %S';
$max_repeat       = 5;

## pdf mode
$pdf_mode         = 3; # 0: none, 1: pdflatex, 2: ps2pdf, 3: dvipdfmx

あとは、vscodeのsetting.jsonに以下を記入

{
    "diffEditor.ignoreTrimWhitespace": false,
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Default Light+",

    // ---------- Language ----------
    "[tex]": {
        // スニペット補完中にも補完を使えるようにする
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // インデント幅を2にする
        "editor.tabSize": 2
    },

    "[latex]": {
        // スニペット補完中にも補完を使えるようにする
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        // インデント幅を2にする
        "editor.tabSize": 2
    },

    "[bibtex]": {
        // インデント幅を2にする
        "editor.tabSize": 2
    },


    // ---------- LaTeX Workshop ----------
    // 使用パッケージのコマンドや環境の補完を有効にする
    "latex-workshop.intellisense.package.enabled": true,

    // ビルドのレシピ
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk",
            "tools": [
                "latexmk"
            ]
        },
    ],

    // ビルドのレシピに使われるパーツ
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-silent",
                "%DOC%"
            ],
        },
    ],
    "latex-workshop.view.pdf.viewer": "tab",
}

タイプセット

command + option + b

実行

command + option + v

よし!! これでVScodetexが動いた!!