1

I've successfully defined my own tcolorbox

\newtcolorbox{cvbox}[2][]{%
  blanker,
  leftupper=4cm,
  rightupper=2cm,
  after skip=1cm,
  title=\textcolor{blue}{\textbf{\uppercase{#2}}},
  breakable,
  #1
}

but I would like to add a bigskip before the content defined by the parameter #1. If I redefine my environment like the following I get a compilation error:

\newtcolorbox{cvbox}[2][]{%
  blanker,
  leftupper=4cm,
  rightupper=2cm,
  after skip=1cm,
  title=\textcolor{blue}{\textbf{\uppercase{#2}}},
  breakable,
  \bigskip #1
}

so I don't know how to prepend it. Is it possible? I don't want to define it each time I use cvbox

2
  • Bertuz, can you provide a compilable MWE? You can also mention the expected behavior in that example.
    – Adarsh
    Aug 12, 2017 at 3:13
  • While MWE should be provided, in your first snippet, the first argument #1 is supposed to be a valid key-value list. What do you mean by prepending \bigskip to a list of key-value settings?
    – yudai-nkt
    Aug 12, 2017 at 3:20

1 Answer 1

2

I think that your sentence I would like to add a bigskip before the content defined by the parameter #1 is not what you want. Parameter #1 is the optional parameter (initially empty) and will serve to add new options or change the already defined options for cvbox. It's not related with box contents.

In case you wanted a \bigskip between cvbox and previous paragraph, you should use before=\bigskip option (which can be introduced as optional parameter when you need it)

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{blindtext}

\newtcolorbox{cvbox}[2][]{%
  blanker,
  leftupper=4cm,
  rightupper=2cm,
  after skip=1cm,
  title=\textcolor{blue}{\textbf{\uppercase{#2}}},
  breakable,
  #1
}
\begin{document}
\blindtext
\begin{cvbox}[before=\bigskip]{Example with bigskip}
\blindtext
\end{cvbox}
\newpage
\blindtext
\begin{cvbox}{Example without bigskip}
\blindtext
\end{cvbox}
\end{document}

enter image description here

But if you want the bigskip between cvbox title and cvboxcontents, you should use before upper=\bigskip option:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{blindtext}

\newtcolorbox{cvbox}[2][]{%
  blanker,
  leftupper=4cm,
  rightupper=2cm,
  after skip=1cm,
  title=\textcolor{blue}{\textbf{\uppercase{#2}}},
  breakable,
  #1
}
\begin{document}
\blindtext
\begin{cvbox}[before upper=\bigskip]{Example with bigskip}
\blindtext
\end{cvbox}
\newpage
\blindtext
\begin{cvbox}{Example without bigskip}
\blindtext
\end{cvbox}
\end{document}

enter image description here

You must log in to answer this question.

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