3

I want to modify itemize indentation inside a tcolorbox environment. At this moment it seems that TeX.stackexchange is not letting me upload an image of the problem, so i'll try to be clear.

I used:

\usepackage{tcolorbox}

\newtcolorbox{mybox}[1]{%colback=red!5!white,
    colframe=red!75!black,
    colback=red!5!white,
    fonttitle=\bfseries,
    coltext=black,
    title=#1} 

to create a box for my presentation. The thing is that when I do, for example:

\begin{mybox}{Definition}
        \setbeamertemplate{itemize items}[circle]
        \begin{itemize}
            \item The spectrometry ...
            \item spectrometers ...
        \end{itemize}
\end{mybox}

The result is a very large itemized items indentation inside the created box. I do not want to modify all my beamer itemize environments indentation, since I have a lot of them in plain text and they are just fine. So, I was wondering how can I just modify this certain environment (mybox). I tried a lot of things, including adding \usepackage[shortlabels]{enumitem}, or \setlength{\leftmargini}{0pt}, among others, with no exit at all. A MWE is shown below.

\documentclass{beamer}
\mode<presentation> {
\usetheme{Madrid}
}
\usepackage{graphicx} 
\usepackage{booktabs} 

\usepackage{tcolorbox} 
\tcbuselibrary{skins,theorems}

\newtcolorbox{mybox}[1]{
    colframe=red!75!black,
    colback=red!5!white,
    fonttitle=\bfseries,
    coltext=black,
    title=#1}
\usepackage{lipsum}    

\begin{document}

\begin{frame}{itemize on text}
\lipsum[3]
\begin{itemize}
\item This is fine
    \begin{itemize}
    \item This is fine as well
    \end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{test}
\begin{mybox}{Definition}
        \setbeamertemplate{itemize items}[circle]
        \begin{itemize}
            \item The spectrometry ...
            \item spectrometers ...
        \end{itemize}
\end{mybox}
\end{frame}

\end{document}

Does anyone knows how to get less indentantion space for this certain environment? Thanks in advance.

  • Please provide a compilable document, not just fragments only – user31729 Oct 3 '17 at 20:05
  • @ChristianHupfer I already added a MWE to the question, thanks. – Jorge V Oct 3 '17 at 20:21
  • Concerning enumitem: That package is wonderful, but not compatible with beamer's overlay mechanism, so never use it with beamer – user31729 Oct 3 '17 at 20:31
3

The tcolorbox default is some left=... value, so having a larger indentation than expected. In addition, there's the width of the left frame rule.

\documentclass{beamer}
\mode<presentation> {
\usetheme{Madrid}
}
%\usepackage{booktabs} 

\usepackage{tcolorbox} 
\tcbuselibrary{skins,theorems}

\newtcolorbox{mybox}[1]{
    colframe=red!75!black,
    colback=red!5!white,
    fonttitle=\bfseries,
    coltext=black,
    left=0pt,
    title=#1}
\usepackage{lipsum}    

\begin{document}

\begin{frame}{itemize on text}
\lipsum[3]
\begin{itemize}
\item This is fine
    \begin{itemize}
    \item This is fine as well
    \end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{test}
\begin{mybox}{Definition}
        \setbeamertemplate{itemize items}[circle]
        \begin{itemize}
            \item The spectrometry ...
              \begin{itemize}
              \item spectrometers ...
              \end{itemize}
        \end{itemize}
\end{mybox}
\end{frame}

\end{document}

enter image description here

  • Woah.. it was quite easy. Thanks for your time @ChristianHupfer, works great. – Jorge V Oct 3 '17 at 20:26
  • @JorgeV: You're welcome. Please take a look on the tcolorbox manual -- it supports also beamer's \only overlay specification – user31729 Oct 3 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.