2

I have the following code,

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{tcolorbox}[enhanced, sharp corners, colback=white, colframe=black, drop shadow={black,opacity=1}]
\subsubsection{Méthode1.3}
Soit G un groupe, noté multiplicativement, et soit $a\in G$. Pour déterminer l'ordre de l'élément $a$, on peut:

\end{itemize}
\end{tcolorbox}

\end{document}

which generates something like,

enter image description here

However, of course it would be an overkill to type

\begin{tcolorbox}[enhanced, sharp corners, colback=white, colframe=black, drop shadow={black,opacity=1}]

every time

Therefore, I wonder if it is possible to redefine the command in some way (perhaps using \newtcolorbox), so that I do not need to type

[enhanced, sharp corners, colback=white, colframe=black, drop shadow={black,opacity=1}]

1 Answer 1

3

Yes, that is what \newtcolorbox is for.

Here is the output with tcolorbox and the MyBox enviroment defined via \newtcolorbox:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[most]{tcolorbox}

\pagecolor{white}

\usepackage{lipsum}

\newtcolorbox{MyBox}[1][]{%
    enhanced, 
    sharp corners,
    colback=white, 
    colframe=black, 
    drop shadow={black,opacity=1},
    #1
}%


\begin{document}

\begin{tcolorbox}[
    enhanced, 
    sharp corners, 
    colback=white, 
    colframe=black, 
    drop shadow={black,opacity=1},
]
\lipsum[1]
\end{tcolorbox}

\begin{MyBox}
\lipsum[1]
\end{MyBox}%

\end{document}
1
  • Thanks. My mistake was putting those options in one of the [ ] before { } in the \newtcolorbox
    – Fraïssé
    Commented Dec 27, 2019 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .