-
Notifications
You must be signed in to change notification settings - Fork 1
figure
オブジェクトを複製するには,複製したいものを選択(shiftを押しながらクリックすると複数選べる)して,
command+d
オブジェクトをグループ化するには,グループにしたいオブジェクトを選択して,
command+g
グループ化の解除は,
command+u
複数回やることが必要な場合もある.
tex2imgを開き,入れたい数式とかを打ち込む.pdfに変換出来たら,Inkscapeで
command+i
を押して,pdfを挿入.挿入したpdfはグループ化されているので,グループ化を解除する.
図と文字のサイズ感が違っている場合が多いが,この場合は図の大きさを変更する.
その後,図の線の太さを1ptに揃える(command+aで一括選択してできる).
図が描けたら,
command+s
で保存して(描いてる途中もこまめに保存する),
command+shift+d
でオプションを開き,「ページサイズをコンテンツに合わせて変更→ページサイズを描画全体または選択オブジェクトに合わせる」を選択して,余白をカット. その後で,
command+shift+s
で,pdfとして保存.
pdfしか無い場合とかは,pdfをinkscapeで開いた後に,
command+shift+s
でsvgで保存する.
fig[大問番号]_[図の番号]みたいにする.
校内模試とかは,第2問[A]みたいな問題番号なので,図の名前はfig2A_1.pdf
fig2A_2.pdfみたいにする
(詳しくはこれ).
LaTeXで図を挿入する.例えば,fig2A_1.pdfを入れる場合は,
\begin{figure}[ht]
\centering
\includegraphics[scale=1]{fig2A_1.pdf}
\caption{}
\label{2A.1}
\end{figure}\caption{}を入れると,図の番号が自動で出力される.引数に何かを入れると,図番号の横に出力される.
\labelは図の番号に対応させる(2A.1とか).
本文中で,図\ref{2A.1}のようにすれば,図番号を参照出来る.
校内模試とか,複数人で集める場合は必ず\labelと\refを使うこと!
図を複数並べる場合は,minipage環境を使う.
\begin{figure}[ht]
\centering
\begin{minipage}{0.49\hsize}
\includegraphics[scale=1]{fig2A_1.pdf}
\caption{}
\label{2A.1}
\end{minipage}
\begin{minipage}{0.49\hsize}
\includegraphics[scale=1]{fig2A_2.pdf}
\caption{}
\label{2A.2}
\end{minipage}
\end{figure}figure環境の中でsubfigure環境を使う.
キャプションは\subcaption{}とする.
\begin{subfigure}[ht]{<width>}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{}
\label{1.1a}
\end{subfigure}キャプションのスタイルは
\setsubfigcapstyle{<f-style>}で指定.<f-style>は\fstyleに使うやつと同じ.
| setsubfigcapstyleの引数 | ラベル |
|---|---|
| arabic | 半角数字 |
| Carabic | 縦長の丸数字(マークシート) |
| Alph | アルファベット大文字 |
| alph | アルファベット小文字 |
| Roman | ローマ数字大文字 |
| roman | ローマ数字小文字 |
| Kakko | 括弧附数字 |
| KAlph | 括弧附アルファベット大文字 |
| Kalph | 括弧附アルファベット小文字 |
| KRoman | 括弧附ローマ数字大文字 |
| Kroman | 括弧附ローマ数字小文字 |
| Maru | 丸数字 |
| KHira | 括弧附50音順ひらがな |
| KKata | 括弧附50音順カタカナ |
| ksuji | 漢数字 |
| Combarabic | 全角半角数字(9以下は全角) |
| iHira | 伊呂波ひらがな |
| iKata | 伊呂波カタカナ |
| Hira | 50音順ひらがな |
| Kata | 50音順カタカナ |
| KHiroha | 括弧附伊呂波ひらがな |
| KKiroha | 括弧附伊呂波カタカナ |
| Wdate | 毎週日付 |
参照は\ref,\subrefを使う.挙動については下の例参照.
図\subref{1.1a} % 図あ
図\ref{1.1b} % 図1い
図\ref{1.1} % 図1
\setsubfigcapstyle{Hira}
\begin{figure}[ht]
\centering
\begin{subfigure}[ht]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{}
\label{1.1a} % あ
\end{subfigure}
\begin{subfigure}[ht]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{} % い
\label{1.1b}
\end{subfigure}
\caption{} % 図1
\label{1.1}
\end{figure}\subcaptionの頭に文字を出すなら
\setfigcapstyle[<string>]{<f-style>}とする.
Fig.\subref{1.2a} % Fig. あ
Fig.\ref{1.2b} % Fig.2い
図\ref{1.2} % 図2
\setsubfigcapstyle[Fig.]{hira}
\begin{figure}[ht]
\centering
\begin{subfigure}[ht]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{} % Fig. あ
\label{1.2a}
\end{subfigure}
\begin{subfigure}[ht]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{} % Fig. い
\label{1.2b}
\end{subfigure}
\caption{} % 図2
\label{1.2}
\end{figure}\subcaptionの初めに\captionを出すには
\setfigcapstyle*{<f-style>}とする(この場合は参照は\subrefしか使えない).
\subref{1.3a} % 図3あ
\subref{1.3b} % 図3い
図\ref{1.3} % 図3
\setsubfigcapstyle*{Hira}
\begin{figure}[ht]
\centering
\begin{subfigure}[t]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{} % 図3あ
\label{1.3a}
\end{subfigure}
\begin{subfigure}[t]{0.25\hsize}
\centering
\includegraphics[scale=0.5]{fig.pdf}
\subcaption{} % 図3い
\label{1.3b}
\end{subfigure}
\caption{} % 図3
\label{1.3}
\end{figure}\setfigcapstyleを使います.
選択肢が終わったら,\normalfigcaptionで元に戻します.
\setfigcapstyleの引数はfstyleと同じです.
| setfigcapstyleの引数 | ラベル |
|---|---|
| arabic | 半角数字 |
| Carabic | 縦長の丸数字(マークシート) |
| Alph | アルファベット大文字 |
| alph | アルファベット小文字 |
| Roman | ローマ数字大文字 |
| roman | ローマ数字小文字 |
| Kakko | 括弧附数字 |
| KAlph | 括弧附アルファベット大文字 |
| Kalph | 括弧附アルファベット小文字 |
| KRoman | 括弧附ローマ数字大文字 |
| Kroman | 括弧附ローマ数字小文字 |
| Maru | 丸数字 |
| KHira | 括弧附50音順ひらがな |
| KKata | 括弧附50音順カタカナ |
| ksuji | 漢数字 |
| Combarabic | 全角半角数字(9以下は全角) |
| iHira | 伊呂波ひらがな |
| iKata | 伊呂波カタカナ |
| Hira | 50音順ひらがな |
| Kata | 50音順カタカナ |
| KHiroha | 括弧附伊呂波ひらがな |
| KKiroha | 括弧附伊呂波カタカナ |
| Wdate | 毎週日付 |
\normalfigcaptionはデフォルトでは\Combarabicになります.変えたい場合は
\normalfigcapsty{<f-type>}で変えます.<f-type>は\fstyle{...}と同じ.
直前まで使っていた形式に戻したい場合は
\previousfigcaptionを使う(恐らくこっちの方が有用).
\setfigcapstyle{Kakko}
\begin{figure}[ht]
\centering
\begin{minipage}{0.24\hsize}
\includegraphics[scale=1]{fig2A_3_1.pdf}
\caption{}
\label{2A.3_1}
\end{minipage}
\begin{minipage}{0.24\hsize}
\includegraphics[scale=1]{fig2A_3_2.pdf}
\caption{}
\label{2A.3_2}
\end{minipage}
\begin{minipage}{0.24\hsize}
\includegraphics[scale=1]{fig2A_3_3.pdf}
\caption{}
\label{2A.3_3}
\end{minipage}
\begin{minipage}{0.24\hsize}
\includegraphics[scale=1]{fig2A_3_4.pdf}
\caption{}
\label{2A.3_4}
\end{minipage}
\end{figure}
\normalfigcaption\ref{2A.3_1}〜\ref{2A.3_4}の中から適切なものを選べ,みたいに,\setfigcapstyleで指定したスタイルで参照出来ます.
\begin{figure}[ht]
\centering
\includegraphics[height=4cm]{fig2A_1.pdf}
\caption{}
\label{2A.1}
\end{figure}だと中央にキャプションが出る.キャプションを左上に出すには
\begin{figure}[ht]
\Lcaption{}
\includegraphics[height=4cm]{fig2A_1.pdf}
\label{2A.1}
\end{figure}とすればいい.
位置調節するには次のようにする(デフォルトでは,図の半分の高さの所にラベルができる):
\begin{figure}[ht]
\centering
\Lincludegraphics[4cm]{fig2A_1.pdf}
{}
{2A.1}
\end{figure}任意の高さに出すには
\begin{figure}[ht]
\centering
\Lincludegraphics*{<int>}[4cm]{fig2A_1.pdf}
{}
{2A.1}
\end{figure}<int>は0〜10までの整数で,0だと下端,10で上端.
TeXソースの中にコードを書くだけで図が描ける.
- 日本語版wiki.まずはこれ読もう
- Visual TiKZ.
で見れる.TikZのサンプルが大量にある.重宝する(
texdoc visualtikz
snakesを使ってたり,少し古い) - TikZのマニュアルはターミナルで
で開ける.Visual TiKZで見つからなかったらこれで探す
texdoc tikz
- 電気回路が描ける
circuitikzもある.マニュアル:入門的な何かを作った.texdoc circuitikz
-
バネ
\begin{tikzpicture} \draw[decorate, decoration={coil, aspect=0.3, amplitude=0.3cm, segment length=1.75mm}] (0,0) -- (2,0); \draw[decorate, decoration={coil, mirror, aspect=0.3, amplitude=0.3cm, segment length=1.75mm}] (6,0) -- (4,0); \end{tikzpicture}
左に向かって描く際は
mirrorをつけるのがポイント. -
PV図
\begin{tikzpicture} \draw[->, >=latex] (0, 0) -- (5, 0) node [right] {$V$}; \draw[->, >=latex] (0, 0) -- (0, 4) node [above] {$P$}; \draw (0, 0) node [below left] {O}; \coordinate (A) at (1, 1); \coordinate (B) at (1, 3); \coordinate (C) at (2, 3); \coordinate (D) at (4, 1); \fill (A) circle [radius=0.1]; \fill (B) circle [radius=0.1]; \fill (C) circle [radius=0.1]; \fill (D) circle [radius=0.1]; \begin{scope}[very thick, decoration={markings, mark=at position 0.6 with {\arrow{stealth}}}] \draw[postaction={decorate}] (A) -- (B); \draw[postaction={decorate}] (B) -- (C); \draw[postaction={decorate}] (C) -- (D); \draw[postaction={decorate}] (D) -- (A); \end{scope} \draw (A) node [below left] {A}; \draw (B) node [above left] {B}; \draw (C) node [above right] {C}; \draw (D) node [below right] {D}; \draw[dashed] (A) -- (1, 0) node [below] {$V_0$}; \draw[dashed] (C) -- (2, 0) node [below] {$2V_0$}; \draw[dashed] (D) -- (4, 0) node [below] {$4V_0$}; \draw[dashed] (A) -- (0, 1) node [left] {$P_0$}; \draw[dashed] (B) -- (0, 3) node [left] {$3P_0$}; \end{tikzpicture}
-
レンズ
\begin{tikzpicture} \draw[->,>=stealth] (-1,0)--(6,0); % lens 1 \draw [bend right = 10] (0,-2) to (0,2) [bend right = 10] (0,2) to (0,-2); % lens 2 \begin{scope}[xshift = 2.5cm] \draw [bend right = 10] (-0.3,-2) to (-0.3,2) -- (0.3,2) [bend right = 10] (0.3,2) to (0.3,-2) -- (-0.3, -2); \end{scope} \draw (0,0)node[below]{0}; \draw (2.5,0)node[below right]{5}; \draw (5,0)node[below]{10}; % light 1 \draw [->, >=stealth, very thick] (0,1.5)--(2.5,0.75); \draw [very thick, dashed] (2.5,0.75)--(5,0); % light 2 \draw [->, >=stealth, very thick] (0,-1.5)--(2.5,-0.75); \draw [very thick, dashed] (2.5,-0.75)--(5,0); % coordinate \draw [<->] (0.5,-2.2)--(4.5,-2.2); \draw (2.5,-2.3)--(2.5,-2.1); \draw (0.5,-2.2)node[left]{$+a$}; \draw (4.5,-2.2)node[right]{$+b$}; \draw (5,0.5)node{$a=-5$}; \end{tikzpicture}
レンズをずらす時は
scope環境を使う -
省略
\begin{tikzpicture} \draw (0,0) to [wavy capacitor] (2,0); \end{tikzpicture}
省略の形をしたコンデンサーを作った.
-
バネ・コイル
\begin{tikzpicture} \drawcoil[R]{(0, 0)}{(4, 0)}{0.3cm}{0.4}{10} \drawcoil[L]{(0, -1)}{(4, 0)}{0.3cm}{0.4}{10} \end{tikzpicture}
巻き方,始点,終点の相対座標,振幅,アスペクト比,巻数を指定
-
circuitikzのサンプルは入門的な何かの最後を見て.
2023年度 開発責任者:和田