我正在根据另一个成功的文档创建一个新文档,但是它太长了,无法用作 MWE。
无论如何,我正在尝试创建一个新的环境,但它缺少一些我不知道要寻找的东西。
这个新的环境就是得到这样的东西:
平均能量损失
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry}
\usepackage{blindtext}
\usepackage[portuguese]{babel}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\RequirePackage[framemethod=default]{mdframed}
%-------Etapa Box------------
\newmdenv[skipabove=7pt,
skipbelow=7pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
backgroundcolor=ocre!10,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
innerbottommargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
linewidth=4pt]{eBox}
%------------------------------------------
%-------Hyperref and BookMark-------
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=ocre,bold}%
\fi
}
}
\renewcommand*{\thechapter}{%
\texorpdfstring{}{\chaptername\space}\arabic{chapter}%
\texorpdfstring{}{: }%
}
% Section numbers without prefix or the place for adding a prefix
% "Section".
\renewcommand*{\thesection}{%
\arabic{chapter}.\arabic{section}%
}
%------------------------------------------
%----------New Theorem---------------
\newtheorem{etapaT}{Passo}[section]
%------------------------------------------
%-------New Environment------------
\newenvironment{etapa}{\begin{eBox}\begin{etapaT}}{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{etapaT}\end{eBox}}
%------------------------------------------
\begin{document}
\tableofcontents
\chapter{Informações}
\section{Conversa informal}
\begin{etapa}
Texto
\end{etapa}
\end{document}
答案1
在这里我使用tcolorbox
而不是mdframed
并为此应用一个单一环境。
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm,headsep=10pt,a4paper]{geometry}
\usepackage{blindtext}
\usepackage[portuguese]{babel}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage[framemethod=default]{mdframed}
\usepackage[most]{tcolorbox}
\usepackage{hyperref}
\definecolor{ocre}{RGB}{243,102,25}
%-------Etapa Box------------
\newmdenv[skipabove=7pt,
skipbelow=7pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
backgroundcolor=ocre!10,
linecolor=ocre,
innerleftmargin=5pt,
innerrightmargin=5pt,
innertopmargin=5pt,
innerbottommargin=5pt,
leftmargin=0cm,
rightmargin=0cm,
linewidth=4pt]{eBox}
%------------------------------------------
%-------Hyperref and BookMark-------
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=ocre,bold}%
\fi
}
}
\renewcommand*{\thechapter}{%
\texorpdfstring{}{\chaptername\space}\arabic{chapter}%
\texorpdfstring{}{: }%
}
% Section numbers without prefix or the place for adding a prefix
% "Section".
\renewcommand*{\thesection}{%
\arabic{chapter}.\arabic{section}%
}
%------------------------------------------
\newtcolorbox[auto counter, number within=section]{etapa}[1][]{
enhanced,
attach title to upper={},
coltitle={ocre},
fonttitle={\bfseries},
title={Passo \thetcbcounter:\ },
sharp corners,
frame hidden,
boxrule=0pt,
borderline west={2pt}{0pt}{ocre},
colback={ocre!10},
overlay={
\node[left,inner sep=6pt,ocre,font=\small] (A) at (interior.east) {$\blacksquare$};},
#1
}
\begin{document}
\tableofcontents
\chapter{Informações}
\section{Conversa informal}
\begin{etapa}
Texto
\end{etapa}
\end{document}