I have the following LaTeX code which creates a warning message box using tcolorbox and puts a warning icon (the triangle warning sign) on the west side of the outer frame. If you wish to be able to run my code to see what’s the problem, you will need to download the warning sign icon which is in a PDF file. Here is the download link:
https://transfert.free.fr/KhC9IhT
Note: The downloaded PDF file must be put in the same directory as the following LaTeX file
And here is the code:
documentclass[11pt]{book}
usepackage[default]{opensans}
usepackage{alltt}
usepackage[listings,skins,most]{tcolorbox}
usepackage{xcolor}
definecolor{WarningBoxBg}{HTML}{000000}
newtcolorbox{WarningBox}[1][]{%
enhanced,
boxsep=8pt,
colback=white,
colframe=WarningBoxBg,
boxrule=0.25pt,
leftrule=35pt,
overlay unbroken and first ={%
node[rotate=0,
anchor=center,
minimum width=1cm,
font=Largesffamilybfseries,
xshift=17.5pt,
white]
at (frame.west) {%
includegraphics[width=13mm]{Warning.pdf}
};
}
}
begin{document}
begin{WarningBox}
This is my warning message!
begin{itemize}
item line-01
item line-02
item line-03
item line-04
item line-05
end{itemize}
end{WarningBox}
end{document}
I have three questions about the above-mentioned code
-
Is there any way to remove the rounded corner of only the inner frame (the one which includes items list) and doing so only on the west(left) side of it?
-
As you can see in the above-mentioned code, I wrote
xshift=17.5pt
, but this was just a random measure that I chose, after multiple attempts and selecting different values, to finally choose this value, which seemed only visually, to be the most appropriate value, allowing to center horizontally the triangle between the outer and inner frames. If you think that there is a more accurate and precise way to proceed, I would appreciate it if you could kindly indicate. -
I don’t know whether this is just my possibly wrong impression, but looking at the generated PDF result, the triangle doesn’t seem to be 100% vertically centered, although I have written
anchor=center
in the above-mentioned code. If you find the same problem, could you kindly suggest a way to solve the issue?
Thanks in advance.
2