New answers tagged

3

Here there are two possible solutions for marginfigures. I think OP wants something like the second, but ... Sidenotes are another problem not solved here. First solution uses a sidebyside box where upper part is the theorem contents and lower part a non floating figure which has been captioned with \captionof command. Second solution uses a tcbraster ...


4

In case that you do not use tcolorbox or tikz for anything else, is a bit overkill use it for a simple box. What I see is AMS theorem-like environment with the definition style in a green box with a vertical rule beside, so I made defined the \definition command that make just that. Note that macros cannot have paragraph breaks, so, if you need will that, ...


4

I have used mdframed instead of tcolorbox. You can see that you have the same result. Here there is my proposal where I have used for theorem, definition, examples, the specific package amsthm with the possibility to create a book: see the specific class of the document \documentclass[12pt]{book}. For to increase the tickness vertical green line you can to ...


7

The following might give you an idea on how to start: \documentclass{article} \usepackage[most]{tcolorbox} \newtcolorbox{mybox}{ enhanced, boxrule=0pt,frame hidden, borderline west={4pt}{0pt}{green!75!black}, colback=green!10!white, sharp corners } \begin{document} \begin{mybox} \textbf{Definition} My definition text here \end{mybox} \end{document}


5

A very light weight solution is to use a tabular. Not as sexy as \tcolorbox and other TikZ based solution, but it compiles fast. The simplest is to use a p-column as wide as the \linewidth. First I define a new column type N and calculate its width to \linewidth minus two tabcolsep. Then the table fits between the margins and will adapt if you change ...


4

Some naive attempt. \documentclass{article} \usepackage[most]{tcolorbox} \newbox\rightbox \begin{document} \tcbset{right box/.style={/utils/exec={\setbox\rightbox=\hbox{\begin{tabular}{@{}l@{}} #1 \end{tabular}}},righthand width=\the\wd\rightbox,comment={\copy\rightbox}}} \begin{tcblisting}{sidebyside, listing and comment,right box={$E=m\,c^2$}} This is ...


9

You can use tcbsidebyside from the xparse library with sidebyside adapt option. % \tcbuselibrary{xparse} % in preamble \tcbsidebyside[sidebyside adapt=right]{<left-hand content>}{<right-hand content>} \documentclass{article} \usepackage[most]{tcolorbox} \tcbuselibrary{xparse} \begin{document} \tcbsidebyside[sidebyside adapt=right,]{ This is ...


4

Yes, this can be achieved rather easily. Draw the box before the code. Now you may say: "Wait, before the code? But then the tikzmarks are not yet set.". This is true, but tikzmark works by writing stuff to the aux file, which gets read at the very beginning. In order to avoid annoying error messages in the first run I wrap the code that draws the frame into ...


6

Yes, this can be done. One way of accomplishing this is to store the coordinates of the frame of the tcolorbox such that we can use them for the frame. This is achieved by the three keys enhanced,remember,overlay={...}. These coordinates then get used for the horizontal coordinates of the frame. \documentclass[12pt,a4paper]{article} \usepackage[skins, ...


6

\documentclass{article} \usepackage[most]{tcolorbox} \begin{document} \begin{tcblisting}{sidebyside,title=Test} % Example of LaTeX code This is \textbf{not} a test. This is not a test. This is not a test. This is not a test. $x+2=0$ $x=-2$ \dotfill $x$ is negative \end{tcblisting} \end{document} In case that the right side should be different in ...


4

Make copies of both \Aboxed and \@Aboxed. Edit the copied versions. \documentclass{article} \usepackage{mathtools,tcolorbox} \makeatletter \let\Asol\Aboxed \let\@Asol\@Aboxed \patchcmd{\Asol}{\@Aboxed}{\@Asol}{}{}% \patchcmd{\@Asol}{\boxed{#1#2}}{\fcolorbox{red}{yellow}{$\displaystyle #1#2$}}{}{}% \makeatother \begin{document} \begin{align*} \Aboxed{n+1 ...


0

Adding \vspace{\baselineskip} next to the second \vspace*{\fill} does the job under different setups. Why it is need in the first place, I don't know.


5

This exploits that atbegshi, which is loaded by eso-pic, puts the contents of the page in a box, \AtBeginShipoutBox. This box can be copied. The following is a proof of principle and works regardless of tcolorbox. It does, however, assume that the user is careful enough to confine the stuff on the left side of the page. There are many ways in which one can ...


0

With the recent update to the LaTeX kernel, that allows using spaces in file names, the {{file} } hack doesn't work anymore. Is there a solution, other than adding a dummy extension (.whatever) to all my extension-less file names?


1

Here is a way to solve the problem. This needs to use overlay unbroken app and overlay first app of the hooks machinery. \documentclass[12pt]{article} \usepackage[skins,many,minted,breakable,hooks]{tcolorbox} \usepackage{fontawesome5} \usemintedstyle{bw} \renewcommand{\ttdefault}{pcr} % Source: https://tex.stackexchange.com/a/124688/6880 \newcommand{\...


3

Remove the @ from the color names. Why? Because now in tcolorbox.sty one finds colback/.colorlet=tcbcolback, colframe/.colorlet=tcbcolframe, and so on. \documentclass{article} \usepackage{xcolor,tikz,tcolorbox} \usetikzlibrary{shadows} \tcbuselibrary{skins,hooks} % from tcolorbox.doc.s_main.sty \newtcolorbox{marker}[1][]{enhanced, before skip=2mm,after ...


7

Welcome! There are issues with too many [ and ] such that the parser does not know what is what. So you need to add braces to help the parser. And I recommend using \newtcolorbox, and to make use of attach boxed title to top. (Of course I hope you do not really use [36] in a real document but rather use \cite along with bibtex or some similar tool.) \...


9

You could use an overlay. \documentclass[12pt]{article} \usepackage[skins]{tcolorbox} \usepackage{fontawesome5} \begin{document} \begin{tcolorbox}[enhanced, title = Code Python, coltitle = black, colbacktitle = black!10!white, colback = white, center title, overlay={% \begin{tcbclipframe} \node[anchor=...


8

What I meant is: \documentclass[12pt]{article} \usepackage{tcolorbox} \newtcolorbox[auto counter,number within=section]{Exercise}[1][]{% before upper=\renewcommand\thempfootnote{\fnsymbol{mpfootnote}}, title=Problem \thetcbcounter} \begin{document} \section{Pft} \begin{Exercise} An exercise\footnote{This is the footnote} with a footnote. \end{Exercise} \...


4

Don't put a center environment around the box. Use the center key to center the box: \begin{tcolorbox} [ center, width=0.9\textwidth ,halign=flush left ,arc=0mm ,title=Bib ,breakable=true ]


6

There is the key auto counter for that purpose. As it turns out, it does not yet automatically harmonize with beamer \pauses. This can be fixed by redefining \tcb@proc@counter@auto to become \def\tcb@proc@counter@auto#1{% \newcounter{tcb@cnt@#1}% \csxdef{tcb@cnt@#1}{tcb@cnt@#1}% \tcb@proc@counter@autoanduse{#1}% \ifcsname resetcounteronoverlays\...


1

Something like this? \documentclass{article} \usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry} \usepackage[most]{tcolorbox} \tcbuselibrary{poster} \newcounter{ic} \usepackage{xcolor} \usepackage{lipsum} \newtcolorbox{Mybox}[2][]{% enhanced,top=0mm,left=2pt,right=2pt, enlarge top by=\baselineskip/2+1mm, enlarge top at break by=0mm,pad at ...


1

This can be accomplished with a custom style for tcolorbox (instead of framed) \documentclass{article} \usepackage{tcolorbox} \tcbuselibrary{hooks,breakable,skins} \newtcolorbox{graphpaperBox}[1][]{ enhanced, sharp corners, breakable, colback=white, underlay={% \begin{tcbclipinterior} \draw[step=5mm, line width=0....


2

Probably I misunderstand your question, but you can just add an optional parameter that inserts the empty lines using before upper. \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{lmodern} \usepackage{blindtext} \usepackage{calc} \newtcolorbox{notebook}[1][0]{ enhanced, breakable, colback=green!10, colframe=green!65!black, ...


4

Section 4.18 of the tcolorbox manual (Version 4.21) discusses the parbox= setting: The text inside a tcolorbox is formatted using a LATEX minipage if the box is unbreakable. If breakable, the box tries a mimicry of a minipage. In a minipage or parbox, paragraphs are formatted slightly different as the main text. If the key value is set to false, the ...


2

This can be accomplished with a custom tikz based style for mdframed (instead of framed) \documentclass{article} \usepackage[framemethod=tikz]{mdframed} \usetikzlibrary{backgrounds} \mdfdefinestyle{graphpaper}{% apptotikzsetting={\tikzset{mdfbackground/.style={}}}, singleextra={% \scoped[on background layer,yshift=\mdfboundingboxheight]{\...


2

Simply make this change: \begin{tcolorbox} → \tcolorbox \end{tcolorbox} → \endtcolorbox


5

After a bit of tweaking \documentclass{article} \usepackage[many]{tcolorbox} \usepackage{lipsum} % -- \tcbset{ titlecommon/.style={ fontupper=\Large\bfseries\sffamily, top=2mm, bottom=2mm, halign=center, sharp corners, leftrule=0.5mm, %to draw left side in subtitle box rightrule=0.5mm, %to draw ...


0

This is not a really elegant solution (yet?) but shows that this can be done in principle. The key ingredient is Martin Scharrer's solution of a closely related problem. The strategy is to save the tcolorbox in a \savebox and then to decompose it into bits that fit. Ironically, for this we do not need breakable. I also added some analog of the \textheight, ...


2

The dvips driver from TikZ is buggy. Use always pdflatex --shell-escape or xelatex or use an own frame macro: \documentclass{article}% \usepackage{auto-pst-pdf}% \usepackage{lipsum,pst-rputover,tcolorbox}% \def\PBox#1{% \psframebox[fillcolor=gray!20,fillstyle=solid,framearc=0.1,linewidth=2pt,linecolor=black!60]{% \makebox[\dimexpr\linewidth-2\...


2

This is the purpose of \tcbline (or \tcblower), the style can be set with the segmentation style key. \documentclass[]{article} \usepackage[margin=0in]{geometry} \usepackage[most]{tcolorbox} \begin{document} \newgeometry{left=0.8in,right=0.8in,top=1.0in, bottom=0.8in} \begin{tcolorbox}[colframe=blue,boxrule=1.3mm,colback=white,width=17cm,height=20cm,after=\...


2

pgf keys are "only" some cleverly packaged macros. Therefore the order in which you use them matters, simply because the order in which you execute macros matters, too. So you may want to put the key that sets the line width "as late as possible". In your case, there are only two keys so you may want to put boxrule=5pt last. \documentclass{article} \...


Top 50 recent answers are included