4

Here in the MWE:

\documentclass{article}
\usepackage[a4paper, portrait, margin=1in, top=.25in, bottom=1.75in]{geometry}
\usepackage{%
  fontspec,
  parskip,
  lastpage,
  booktabs,
  polyglossia,
  graphicx, 
  fancyhdr,
  lato
}

\usepackage[many]{tcolorbox}

\usepackage[shortlabels]{enumitem}

\setmainfont{Lato}

\usepackage{hyperref}

\setlength{\headheight}{1.15in}
\setlength{\headsep}{.15in}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\lhead{\footnotesize{Hello\\Hello }}
\rhead{}
\rfoot{}
\pagestyle{fancy}

\setcounter{secnumdepth}{-1}

\begin{document}
  \begin{center}
      \begin{tcolorbox}[enhanced jigsaw,opacityback=0,sharp corners]
        \begin{enumerate}
          \item This is 1
          \item This is 2
        \end{enumerate}
      \end{tcolorbox}
  \end{center}
    \begin{enumerate}
      \item This is 1
      \item This is 2
    \end{enumerate}

\end{document}

The enumerate spacing between items in and out the tcolorbox is different.

How do I get the spacing in tcolorbox to be the same as that out the tcolorbox (the default spacing between items)?

  • So which spacing do you want? The inner can be achieved by setting noitemsep for lists. For the outer you would have to set \itemsep. Btw: Do not use center around a tcolorbox. – TeXnician Nov 4 '17 at 8:21
  • Sorry I thought I had commented in your other question about this but I must have got distracted and then forgot. – Ulrike Fischer Nov 4 '17 at 9:52
  • @UlrikeFischer Not a problem. I thought a new question would be useful, anyway. And thanks for your reply here. Works perfectly. – deshmukh Nov 5 '17 at 11:19
  • @TeXnician I could have explicitly mentioned it. But I was aiming to get the 'default' spacing in the lists, i.e. out the tcolorbox. I have edited the question to include this. And thanks for pointing out redundant center environment. – deshmukh Nov 5 '17 at 11:22
3

You are using the parskip package but tcolorbox uses internally a minipage which resets parskip. If you want as spacing the one you get outside the box you can avoid the change of the inner spacing with the parbox=false option:

\documentclass{article}
\usepackage[a4paper, portrait, margin=1in, top=.25in, bottom=1.75in]{geometry}
\usepackage{%
  fontspec,
  parskip,
  lastpage,
  booktabs,
  polyglossia,
  graphicx,
  fancyhdr,
  lato
}

\usepackage[many]{tcolorbox}

\usepackage[shortlabels]{enumitem}

\setmainfont{Lato}

\usepackage{hyperref}

\setlength{\headheight}{1.15in}
\setlength{\headsep}{.15in}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\lhead{\footnotesize{Hello\\Hello }}
\rhead{}
\rfoot{}
\pagestyle{fancy}

\setcounter{secnumdepth}{-1}

\begin{document}
  \begin{center}
      \begin{tcolorbox}[enhanced jigsaw,opacityback=0,sharp corners,parbox=false]
        \begin{enumerate}
          \item This is 1
          \item This is 2
        \end{enumerate}
      \end{tcolorbox}
  \end{center}
    \begin{enumerate}
      \item This is 1
      \item This is 2
    \end{enumerate}

\end{document}

enter image description here

5

You can simply achieve the inner spacing by setting noitemsep using enumitem. (Btw: I've removed the unnecessary center environment.)

list spacing

\documentclass{article}
\usepackage[a4paper, portrait, margin=1in, top=.25in, bottom=1.75in]{geometry}
\usepackage{%
  fontspec,
  parskip,
  lastpage,
  booktabs,
  polyglossia,
  graphicx, 
  fancyhdr,
  lato
}

\usepackage[many]{tcolorbox}

\usepackage[shortlabels]{enumitem}

\setmainfont{Lato}

\usepackage{hyperref}

\setlength{\headheight}{1.15in}
\setlength{\headsep}{.15in}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\lhead{\footnotesize{Hello\\Hello }}
\rhead{}
\rfoot{}
\pagestyle{fancy}

\setcounter{secnumdepth}{-1}
\setlist[enumerate]{noitemsep}

\begin{document}
    \begin{tcolorbox}[enhanced jigsaw,opacityback=0,sharp corners]
      \begin{enumerate}
        \item This is 1
        \item This is 2
      \end{enumerate}
    \end{tcolorbox}
    \begin{enumerate}
      \item This is 1
      \item This is 2
    \end{enumerate}

\end{document}

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.