ホーム
/
作ったもの
/
考えたこと
/
きろく

定理環境などの配布

LaTeX - テンプレート置き場

 普段使っているプリアンブルです。そろそろ一新したいと思うものの、案外これで耐えています。 ご自由に使ってください。

見た目

 見た目はこのようになっています。 ガッツリ囲む感じの枠です。 ナンバリングなどは自動で行われますが、定理や定義などで独立しています。 実は、今はナンバリングが共通していたほうがわかりやすい派閥です。 いつかTeXコードを修正したい思っています。

Report Title Image
図1.定理環境の見た目

使い方

 若干癖があります。 コピペして使ってみてください。

\begin{document}

\begin{definition}{○○(hogehoge)}{}
  ここに○○(hogehoge)の定義文を書く。
\end{definition}
            
\begin{theorem}{○○(hogehoge)}{}
  ここに○○(hogehoge)の定理文を書く。
\end{theorem}
            
\begin{lemma}{○○(hogehoge)}{}
  ここに○○(hogehoge)の補題文を書く。
\end{lemma}
            
\begin{problem}{○○(hogehoge)}{}
  ここに○○(hogehoge)の問題文を書く。
\end{problem}
            
\begin{exproblem}{○○(hogehoge)}{}
  ここに○○(hogehoge)の例題文を書く。
\end{exproblem}
            
\begin{answer}{○○(hogehoge)}{}
  ここに○○(hogehoge)の解答文を書く。
\end{answer}
            
\begin{question}
  ここに質問文を書く。\\
\end{question}
            
\begin{exercise}{}{}
  ここに演習問題を書く。
\end{exercise}
            
\begin{exanswer}[x.y.z]
  ここに演習問題の解答を書く。
\end{exanswer}
            
\end{document}

プリアンブル

 コピペして使ってください。必要なパッケージは書いてある通りです。

\documentclass{ltjsarticle}

\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{mdframed}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{chngcntr}
\usepackage{amsmath}
            
            
\definecolor{titlecolor}{RGB}{0,31,63} 
            
% 定義環境
\newtcbtheorem{definition}{定義}{%
    colback=white,
    colframe=black!70,
    fonttitle=\bfseries,
    fontupper=\itshape,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    }{def}
            
% 定理環境
\newtcbtheorem{theorem}{定理}{%
    enhanced,
    colback=white,
    colframe=black!70,
    fonttitle=\bfseries,
    fontupper=\itshape,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    }{thm}
            
% 定理環境
\newtcbtheorem{lemma}{補題}{%
    enhanced,
    colback=white,
    colframe=black!70,
    fonttitle=\bfseries,
    fontupper=\itshape,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    }{lem}
            
% 問題環境
\newtcbtheorem{problem}{問題}{%
    enhanced,
    colback=black!5,
    colframe=black!70,
    fonttitle=\bfseries,
    fontupper=\itshape,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    }{prb}
            
% 問題環境
\newtcbtheorem{exproblem}{例題}{%
    enhanced,
    colback=black!5,
    colframe=black!70,
    fonttitle=\bfseries,
    fontupper=\itshape,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    }{eprb}
            
% 解答環境
\newtcbtheorem{answer}{      }{%
    enhanced,
    colback=white,
    colframe=white,
    fonttitle=\bfseries,
    fontupper=\normalfont,
    arc=0mm,
    separator sign none,
    description delimiters={}{},
    left=5mm,
    overlay={
        \draw[dashed, gray!70] (frame.north west)--(frame.south west);
        \node[anchor=north west, inner sep=0pt] at (frame.north west) {\textbf{ 解答}};
    },
}{ans}
            
%質問環境
\newtheorem{question}{質問}[subsection]
            
%演習環境
\newtheorem{exercise}{演習}[subsection]
            
%演習解答環境
\newcounter{exanswer}
\newenvironment{exanswer}[1][]{%
\refstepcounter{exanswer}%
\ifstrempty{#1}{\textbf{解答 \theexanswer}}{\textbf{解答 #1}}%
}{%
\qed%
}