0

I want to DIY a environment like the tcolorbox stye:

enter image description here

and I read the docs of tcolorbox and find this:

    \begin{docTcbKey}[][doc new=2014-11-28]{no recording}{}{}
  Disables \refCom{tcbrecord} and \refKey{/tcb/record} inside the current
  group.
\end{docTcbKey}

and the docTcbkey is define as \tcbmakedocSubKey{docTcbKey}{tcb}

but the doctcbkey is write latex3:

    \NewDocumentCommand \tcbmakedocSubKey { m m }
  {
    \NewDocumentEnvironment{#1}{ O{} +O{} m m +m }
      {
        \__tcobox_doc_entry_begin:nnn
          {
            doc@sub@keypath=#2,
            doc~keypath=##1,
            doc~name={##3},
            doc~parameter={##4},
            doc~description={##5},
            ##2
          }
          {}{key}
      }
      {
        \__tcobox_doc_entry_end:n { key }
      }
    \NewDocumentEnvironment{#1*}{}
      {
        \group_begin:
        \tcb@doc@toindexfalse
        \begin{#1}
      }
      {
        \end{#1}
        \group_end:
      }
  }

it is complex, it is more easy to design a new tcolorbox environment and I want to make a key like this: enter image description here

  1. first replace /tcb withtcb 2.then the delimiter / with _
  2. then last number `123`` can be changed to any number that can be filled
  3. the right side is with other text
  4. here is the template : change the /tcb/vig/south to SYS_VIG_123
1

The simple one!

\colorlet{shadecolor}{blue!10}

\colorbox{blue!10}{Put your text}
2
  • 2
    Well sure, you can use a butter knife to cut down a tree, buck up into rounds and then split them into firewood, sure...
    – Werner
    Mar 4 '21 at 16:03
  • Would you share us the best way? So, that we can learn. Actually, I've difficulties to use \linenumbers, along with \colorlet{shadecolor}. Mar 5 '21 at 9:48
1
\documentclass{article}
\usepackage[most]{tcolorbox}

\newcommand{\mykey}[3][]{%
    \begin{tcolorbox}[colback=red!30, 
    boxrule=0pt, attach title to upper={\hfill},
    fonttitle=\ttfamily, coltitle=purple,title=#2,#1]#3\end{tcolorbox}}
    
\begin{document}
\mykey{Some text}{More text}

\mykey[colback=cyan!30, coltitle=blue!70!black]{Some text}{More text}
\end{document}

enter image description here

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.