I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows:
\documentclass[10pt]{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings,breakable,skins}
\tcbset{
above/.style={colback=lightgray,colbacklower=white,listing and text,center lower},%
below/.style={colback=white,colbacklower=lightgray,text and listing,center upper},%
left/.style={colback=lightgray,colbacklower=white,listing side text,valign=center},%
right/.style={colback=white,colbacklower=lightgray,text side listing,valign=center},%
frame/.style={colframe=#1},%
ratio/.style={lefthand ratio=#1},%
noframe/.style={frame hidden,arc=0mm},%
number/.style={listing options={}},%
nonumber/.style={listing options={}},%
myexample/.style={breakable,skin=bicolor,
%above,%
%number,%
frame=gray,%
title style={draw=none,fill=none}%
}%
}%
\newtcblisting{example}[1]{myexample,#1}
\begin{document}
\begin{example}{above}
My example above in \LaTeX
\end{example}
\end{document}
I want an option "above,below,left or right" is always the first obligate,for example:
\begin{example}{above,noframe}
My example above in \LaTeX
\end{example}
is correct and
\begin{example}{noframe,above}
My example above in \LaTeX
\end{example}
Wrong. I tried with the "xstring" package but have not been successful,an idea like this:
\NewDocumentEnvironment{example}{...}{%
\IfStrEqCase{#1}{%
{% Case 1
% Case 2
% Case 3
% Case ...
}%
%
\begin{example}}% or \begin{tcblisting}{#1}}
{\end{example}} % or \end{tcblisting}
but not if it is correct, or if there is a more effective way to achieve this. Thanked beforehand (kvoptions,etoolbox maybe). Pablo
above,below,leftorright? – egreg Nov 26 '13 at 00:32