<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" >
  <channel>
  <title>LaTeXメモ</title>
  <link>https://latex.ria10.com/</link>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="https://latex.ria10.com/RSS/" />
  <description></description>
  <lastBuildDate>Tue, 15 Dec 2020 13:57:00 GMT</lastBuildDate>
  <language>ja</language>
  <copyright>© Ninja Tools Inc.</copyright>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />

    <item>
    <title>条件分岐：\ifcase</title>
    <description>
    <![CDATA[C言語においては、<br />
<img src="//latex.ria10.com/File/20121501.png" alt="" /> <br />
とif文を並べて書く代わりに、<br />
<img src="//latex.ria10.com/File/20121502.png" alt="" /> <br />
とする（swtich文と）caseを用いた記述が存在する。<br />
<br />
$\mathrm{\LaTeX}$（というか $\mathrm{\TeX}$&nbsp;だけど）においても \ifcase を用いてこれを実現できる。<br />
<br />
プリアンブル
<pre>\newcommand{\case}[1]{\makebox[1zw][c]{%
	<span style="color: #ff0000;">\ifcase</span> #1%
		\or I.\or II.\or III.\or IV.\or V.%
		\or VI.\or VII.%
	\fi%
}}%
</pre>
<br />
コマンド
<pre>\case{1}$x=3$のとき、&hellip;
\case{2}$x=5$のとき、&hellip;
\case{3}$x=7$のとき、&hellip;
</pre>
<br />
今回はローマ数字の幅揃えを例とした。$\mathrm{\LaTeX}$ 上での表示は以下の通り。<br />
<img src="//latex.ria10.com/File/20121503.png" alt="" /><br />
※　\case{0} の時の動作を指定したい場合は、最初の \or の前に記述する。]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90%EF%BC%9A-ifcase</link>
    <pubDate>Tue, 15 Dec 2020 13:57:00 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/8</guid>
  </item>
    <item>
    <title>複雑なオプション付きマクロの作成</title>
    <description>
    <![CDATA[基本的なマクロは $\mathrm{\LaTeX}$ 上で&nbsp;\newcommand を用いて作成できるが、星付きマクロや複数のオプション引数を設定することはできない。<br />
そこで、&nbsp;$\mathrm{\TeX}$ 上で&nbsp;\def を用いたマクロの作成を行う。<br />
<br />
プリアンブル
<pre>\makeatletter
\def\hogeA{%
	<span style="color: #ff0000;">\@ifstar</span>{%
		%処理星付き%			1番
	}{%
		%処理星なし%			2番
	}%
}%
\def\hogeB#1{%
	<span style="color: #ff0000;">\@ifnextchar[</span>{%
		\@hogeB{#1}%
	}{%
		%処理オプションなし%	3番
	}%
}%
\def\@hogeB#1[#2]{%
	%処理オプションあり%		4番
}%
</pre>
コマンド
<pre>\hogeA*				%　1番
\hogeA				%　2番
\hogeB{引数1}			%　3番
\hogeB{引数1}	[引数2]	%　4番
</pre>
\@ifstarが引数を2つ取る。（\@ifstar{処理1}{処理2}）<br />
\@ifnextcharが引数を3つ取る。（\@ifnextchar文字{処理1}{処理2}）]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E8%A4%87%E9%9B%91%E3%81%AA%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E4%BB%98%E3%81%8D%E3%83%9E%E3%82%AF%E3%83%AD%E3%81%AE%E4%BD%9C%E6%88%90</link>
    <pubDate>Sun, 13 Dec 2020 11:13:59 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/7</guid>
  </item>
    <item>
    <title>ページ幅の均等分割</title>
    <description>
    <![CDATA[厳密には「印刷領域の」均等分割を行う。イメージは下図の通り。<br />
<img src="//latex.ria10.com/File/18051101.png" alt="" style="border: solid 1px #cccccc;" /><br />
<br />
multicols 環境を利用した段組みでも（一応）実現はできるが、これは列ごとに組版を行うため、<br />

<ul>
<li>2行以上記述する場合、高さの調整が手間</li>
<li>2行以上記述する場合、記述する順序が複雑</li>
</ul>
などの欠点がある。<br />
そこで、tabularxパッケージを用いた表を活用する。<br />
<br />
プリアンブル
<pre>\usepackage{tabularx}%
\newenvironment{admulticol}[1]{%
	\begingroup%
	\setlength{\tabcolsep}{0pt}%
	\tabularx{\textwidth}{*{#1}{X}}%
}{%
	\endtabularx%
	\endgroup%
}%</pre>
コマンド
<pre>\begin{<span style="color: red;">ad</span>multicol}{分割数}
	(1) ～～～～～ &amp; (2) ～～～～～ &amp; &hellip; \\
	&hellip;
\end{<span style="color: red;">ad</span>multicol}</pre>]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E6%A8%AA%E5%B9%85100%EF%BC%85%E3%81%AB%E5%BA%83%E3%81%8C%E3%82%8B%E8%A1%A8</link>
    <pubDate>Fri, 11 May 2018 14:36:53 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/6</guid>
  </item>
    <item>
    <title>ぶら下げインデント</title>
    <description>
    <![CDATA[<pre>問題　日本の都道府県のうち、その名前に「川」という文字が入っている都道府県が
　　　ない地方は、次のうちどれでしょう？</pre>
のような、段落2行目以降のインデントを「ぶら下げインデント」と言うらしい。<br />
$\mathrm{\LaTeX}$ 上では、この長さは \hangindent により定められる。<br />
<br />
\hangindent を毎回手動で定めるのは手間なので、マクロにより自動化する。<br />
<br />
プリアンブル
<pre>\newcommand{\hang}[1]{%
	\settowidth{\hangindent}{#1}%
	#1%
}%</pre>
コマンド
<pre>\<span style="color: red;">hang</span>{問題　}日本の都道府県のうち、&hellip;</pre>
備考：<br />
\hangindent の長さは段落を跨ぐと 0pt にリセットされるようだ。]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E3%81%B6%E3%82%89%E4%B8%8B%E3%81%92%E3%82%A4%E3%83%B3%E3%83%87%E3%83%B3%E3%83%88</link>
    <pubDate>Tue, 08 May 2018 14:33:41 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/5</guid>
  </item>
    <item>
    <title>\underbraceの調整</title>
    <description>
    <![CDATA[通常の \underbrace は、
<ul>
<li>$y=\underbrace{(x+1)^2}_{x^2+2x+1}$ のようにコメント部分が短い場合は整然としているが、</li>
<li>$y=\underbrace{(x+1)^4}_{x^4+4x^3+6x^2+4x+1}$ のようにコメント部分が長くなると、式に隙間が空いて不格好になる。</li>
</ul>
これを調整し、コメント部分が長いケースのみ、式の隙間を詰めるようにする。<br />
<br />
プリアンブル
<pre>\usepackage{ifthen}%
\newlength{\wdTempA}%
\newlength{\wdTempB}%
\newcommand{\adunderbrace}[2]{%
	\settowidth{\wdTempA}{$#1$}%
	\settowidth{\wdTempB}{${\scriptstyle #2}$}%
	\ifthenelse{\wdTempA&lt;\wdTempB}{%
		\hspace*{.5\wdTempA}\hspace*{-.5\wdTempB}%
		\underbrace{#1}_{#2}%
		\hspace*{.5\wdTempA}\hspace*{-.5\wdTempB}%
	}{%
		\underbrace{#1}_{#2}%
	}%
}%
</pre>
コマンド
<pre>$\<span style="color: red;">ad</span>underbrace{数式}{コメント}$		%　{}{}の間に_は不要
</pre>
実際の $\mathrm{\LaTeX}$ での表示は以下の通り。<br />
<img src="//latex.ria10.com/File/18050601.png" alt="" />]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/underbrace%E3%81%AE%E8%AA%BF%E6%95%B4</link>
    <pubDate>Sun, 06 May 2018 13:55:21 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/4</guid>
  </item>
    <item>
    <title>長さに関して</title>
    <description>
    <![CDATA[標準的な長さ
<pre>\textwidth		%  本文領域の横の長さ
\textheight	%  本文領域の縦の長さ
\linewidth		%  1行に記述できる長さ（複数カラム環境で短くなる）
\baselineskip	%  1行の高さ、jsarticle環境で16.0pt</pre>
表に関する長さ
<pre>\tabcolsep		%  セルの余白、htmlでのpadding
\arrayrulewidth	%  罫線の太さ
\doublerulesep	%  2重罫線の間隔</pre>
段落に関する長さ
<pre>\leftskip		%  段落の左余白
\rightskip		%  段落の右余白
\parindent	%  1行目のインデント（字下げ）
\hangindent	%  2行目以降のインデント（ぶら下げ）</pre>
長さを格納する変数（レジスタ）の操作
<pre>\newlength{\temp}				%  \temp を宣言
\setlength{\temp}{0.5\linewidth}	%  \temp に \linewidth の0.5倍を代入
\addtolength{\temp}{-1zw}		%  \temp に -1zw の長さを加算
\settowidth{\temp}{xyz}			%  \temp に xyz の幅を代入
\settoheight{\temp}{xyz}			%  \temp に xyz の高さ（ベースラインより上）を代入
\settodepth{\temp}{xyz}			%  \temp に xyz の深さ（ベースラインより下）を代入</pre>]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E9%95%B7%E3%81%95%E3%81%AB%E9%96%A2%E3%81%97%E3%81%A6</link>
    <pubDate>Sun, 06 May 2018 07:00:37 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/3</guid>
  </item>
    <item>
    <title>ifthen.sty</title>
    <description>
    <![CDATA[プリアンブル
<pre>\usepackage{ifthen}</pre>
条件分岐
<pre>\ifthenelse{条件文}{%
	真の場合の処理
}{%
	偽の場合の処理
}%</pre>
条件文の書き方
<pre>\value{cntNum} = 3		%  cntNum の値が3なら真
\lengthtest{\temp} &lt; 3pt	%  \temp の長さが3pt未満なら真
\equal{#1}{c}			%  引数 #1 が文字列cと一致するなら真
\isundefined{\calc}		%  \calc が未定義なら真
</pre>
演算子
<pre>\NOT \value{cntNum} = 3			%  cntNum の値が3でないなら真
\equal{#1}{c} \AND \equal{#2}{r}	%  #1がc、かつ#2がrなら真
\equal{#1}{c} \OR \equal{#2}{r}	%  #1がc、または#2がrなら真
\NOT \( #1&lt;4 \AND #2&lt;6 \)		%  「#1&lt;4、かつ#2&lt;6」でないなら真
</pre>]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/ifthen.sty</link>
    <pubDate>Sun, 06 May 2018 05:52:25 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/2</guid>
  </item>
    <item>
    <title>記事のテスト</title>
    <description>
    <![CDATA[このHPでは、$\mathrm{\LaTeX}$ を用いて数式を記述するためにMathJaxを利用している。<br />
<br />
$A:\{2x\mid x\in\mathbb{R}\}$<br />
$\displaystyle \sum_{k=1}^{n}k^2=\dfrac{1}{6}n(n+1)(2n+1)$]]>
    </description>
    <category>未選択</category>
    <link>https://latex.ria10.com/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E8%A8%98%E4%BA%8B%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88</link>
    <pubDate>Sun, 06 May 2018 05:25:08 GMT</pubDate>
    <guid isPermaLink="false">latex.ria10.com://entry/1</guid>
  </item>

    </channel>
</rss>