두 개의 상자가 있는 예제 환경

두 개의 상자가 있는 예제 환경

나는 "예제" 환경을 다음과 같이 보이도록 노력하고 있습니다.

여기에 이미지 설명을 입력하세요

"Example"이라는 단어 앞에 두 개의 상자가 있습니다. 이 효과를 얻을 수 있도록 도와주실 수 있나요?

다음은 몇 가지 코드입니다.

\documentclass[11pt,fleqn,table]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\definecolor{ocre}{RGB}{0,173,239}

%======================================================================================
%  EXAMPLE ENVIRONMENT
%======================================================================================

\newtheorem{exampleT}{Example}[chapter]
\newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}}

\makeatletter
\newtheoremstyle{blacknumexocresq}
{5pt}
{5pt}
{\normalfont}
{} 
{\small\bf\sffamily}
{\;}
{0.25em}
{\small\sffamily{\textcolor{ocre}{\tiny\ensuremath{\blacksquare}}}\nobreakspace\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% 
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}
\makeatother

\theoremstyle{blacknumexocresq}
\newtheorem{exampleM}{Example}[chapter]

\renewenvironment{example}{\begin{exampleM}}{\hfill{\textcolor{ocre}{\tiny\ensuremath{\blacksquare}}}\end{exampleM}}

\begin{document}

\chapter{This is where the example is}
\begin{example}
This is where the example will take place
\end{example}

\end{document}

답변1

\ensuremath{\blacksquare}다음으로 대체하여 \ensuremath{\square\raise0.2em\hbox to 0.2em{\hss$\blacksquare$}}두 개의 상자를 만들 수 있습니다 .

\documentclass[11pt,fleqn,table]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\definecolor{ocre}{RGB}{0,173,239}

%======================================================================================
%  EXAMPLE ENVIRONMENT
%======================================================================================

\newtheorem{exampleT}{Example}[chapter]
\newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}}

\makeatletter
\newtheoremstyle{blacknumexocresq}
{5pt}
{5pt}
{\normalfont}
{} 
{\small\bf\sffamily}
{\;}
{0.25em}
{\small\sffamily{\color{ocre}\tiny\ensuremath{\square\raise0.2em\hbox to 0.2em{\hss$\blacksquare$}}}\nobreakspace\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% 
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}
\makeatother

\theoremstyle{blacknumexocresq}
\newtheorem{exampleM}{Example}[chapter]

\renewenvironment{example}{\begin{exampleM}}{\hfill{\textcolor{ocre}{\tiny\ensuremath{\blacksquare}}}\end{exampleM}}

\begin{document}

\chapter{This is where the example is}
\begin{example}
This is where the example will take place
\end{example}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

가장 쉬운 방법은 정리 제목에 상자를 넣고 tikz로 그리는 것이라고 생각합니다.

\documentclass{book}
\usepackage{amsthm}
\usepackage{tikz}
\newcommand{\boxes}{%
\begin{tikzpicture}
    \draw [black] (0,0) rectangle (1.2ex,1.2ex);%
    \fill [black] (0.4ex,0.4ex) rectangle (1.6ex,1.6ex);%
\end{tikzpicture}
}
\newtheorem{example}{\boxes Example}[chapter]

\begin{document}

\chapter{This is where the example is}
\begin{example}
This is where the example will take place
\end{example}

\end{document}

관련 정보