
Ich versuche, meine „Beispielumgebung“ so aussehen zu lassen:
mit den beiden Kästchen vor dem Wort „Beispiel“. Können Sie mir helfen, diesen Effekt zu erzielen?
Hier ist ein Teil des Codes:
\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}
Antwort1
Sie können \ensuremath{\blacksquare}
durch ersetzen \ensuremath{\square\raise0.2em\hbox to 0.2em{\hss$\blacksquare$}}
, um die beiden Felder zu erstellen.
\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}
Antwort2
Ich denke, der einfachste Weg ist, die Kästchen in den Theoremtitel einzufügen und sie mit Tikz zu zeichnen.
\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}