重新定义环境,以便获得一些视觉效果

重新定义环境,以便获得一些视觉效果

我通常使用预定义的环境定义来编写定义,例如:

\begin{definition}[THE WORD]
...
\end{definition}

我想要两件事:首先,单词定义用黑色下划线(与单词颜色相同);其次,之后出现的单词([] 中的单词)用红色书写。

之后直接写入元素的定义,是否可以将其放在一行中?然后只

" definition (the word).
blablabla..."

如果最终我可以在不改变代码的情况下完成所有这些更改(仅在代码开头应用修改,并保持样式\begin{definition}[THE WORD]),那就太棒了


我的文档的选项是:

这是一本书,我准备给你发一张图片,我使用的包装有很多……我认为只有盒子里的那个让你感兴趣:

\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{fancybox} 

但是是的,我使用了所有其他经典的软件包,例如 tikz 或数学内容软件包。

在此处输入图片描述

\documentclass[12pt,a4paper,twoside,openright]{book}
\input{../configuration/configuration}

\begin{document}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{comment}
\usepackage{lipsum}
\usepackage{mwe}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{dsfont}
\usepackage{amsthm}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}

\usepackage{fancybox}

\usepackage{shorttoc}
\usepackage{tikz}
\usepackage{graphicx}
    \graphicspath{{images/}}
\usepackage[left=3.5cm,right=2.5cm,top=4cm,bottom=4cm]{geometry}
\usepackage[Lenny]{fncychap}
\usepackage{fancyhdr}
    \setlength{\headheight}{15pt}


\usepackage{array}  




%%%%%%%%%%%%%% les boites !!!!


\newtheorem{remarque}{Remarque}[chapter] 


\newtcolorbox[auto counter, number within=section]{theoreme}[2][]{%
    colback=white!95!roug,
    colframe=roug,
    colbacktitle=white!80!roug,
    coltitle=black,
    fonttitle=\bfseries, 
    title=Théorème~\thetcbcounter.\ #2,
    enhanced,
    attach boxed title to top left={yshift=-2mm, xshift=0.5cm},%
    #1% For possible options
}





\tcbset{
    thmbox/.style={
        enhanced,
        breakable,
        sharp corners=all,
        fonttitle=\bfseries\normalsize,
        fontupper=\normalsize\itshape,
         top=0mm,
         bottom=0mm,
         right=0mm,
        %colback=white,
        colframe=white,
        colbacktitle=white,
        %coltitle=red,
        attach boxed title to top left,
        boxed title style={empty, size=minimal, bottom=1.5mm},
        overlay unbroken ={
            \draw (title.south west)--(title.south east);
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        overlay first={
            \draw (title.south west)--(title.south east); 
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay middle={
            \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);
            \draw (frame.north east)--(frame.south east);},
        overlay last={
            \draw ([xshift=3.5mm]frame.north west)|-%
                  (frame.south east)--(frame.north east);},
        },
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    SV/.style={thmbox, coltitle=vert, colback=white!95!vert,
        overlay unbroken ={
            \draw[vert][thick] (title.south west)--(title.south east);
            \draw[vert][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay first={
            \draw[vert][thick] (title.south west)--(title.south east); 
            \draw[vert][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw[vert][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw[vert][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        },
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    SO/.style={thmbox, coltitle=oran, colback=white!95!oran,
        overlay unbroken ={
            \draw[oran][thick] (title.south west)--(title.south east);
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay first={
            \draw[oran][thick] (title.south west)--(title.south east); 
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        },   
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    LQ/.style={thmbox, coltitle=viol, colback=white!95!viol,
        overlay unbroken ={
            \draw[viol][thick] (title.south west)--(title.south east);
            \draw[viol][thick] ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
        overlay first={
            \draw[viol][thick] (title.south west)--(title.south east); 
            \draw[viol][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw[viol][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw[viol][thick] ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
    },  
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    SP/.style={thmbox, coltitle=oran, colback=white,
        overlay unbroken ={
            \draw[oran][thick] (title.south west)--(title.south east);
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay first={
            \draw[oran][thick] (title.south west)--(title.south east); 
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw[oran][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        },   
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    LR/.style={thmbox, coltitle=mauv, colback=white!95!mauv,
        overlay unbroken ={
            \draw[mauv][thick] (title.south west)--(title.south east);
            \draw[mauv][thick] ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
        overlay first={
            \draw[mauv][thick] (title.south west)--(title.south east); 
            \draw[mauv][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay middle={
            \draw[mauv][thick] ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);},
        overlay last={
            \draw[mauv][thick] ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);
            \node[anchor=east] at (frame.south east) {$\square$};},
    },  
}


\newtcbtheorem[auto counter, number within=section]{ajoutationV}{Exemple}{thmbox,SV}{theo}
\newtcbtheorem[auto counter, number within=section]{ajoutationO}{Exercice}{thmbox,SO}{theo}
\newtcbtheorem[auto counter, number within=section]{demo}{Démonstration}{thmbox,LQ}{theo}
\newtcbtheorem[auto counter, number within=section]{solu}{Correction}{thmbox,LR}{theo}

\newtcbtheorem[auto counter, number within=section]{entrainement}{Entrainement}{thmbox,SP}{theo}


\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\end{document}

答案1

您可以创建自己的定理风格,但请重新考虑使用下划线,还有许多其他(好的)方法来强调文本。

\documentclass{book}

\usepackage{xcolor}
\usepackage{amsthm}



\newtheoremstyle{Marine}% name 
{3pt}% Space above 
{3pt}% Space below 
{}% Body font 
{}% Indent amount 
{}% Theorem head font
{:}% Punctuation after theorem head
{\newline}% Space after theorem head 
{\underline{\thmname{#1}\thmnumber{ #2}}\thmnote{ \textcolor{red}{ (#3)}}}% Theorem head spec (can be left empty, meaning ‘normal’)

\theoremstyle{Marine}
\newtheorem{definition}{Definition}[section]

\begin{document}


\begin{definition}[THE WORD]
test
\end{definition}


\end{document}

在此处输入图片描述

相关内容