Make the radius of the rounded corners
smaller. Remove =10mm
and you will see the instant effect. Also, in your case, I find no need to load the xcolor
package since it is used internally by tikz
, unless, as noted by Alain Matthes, you use some of its options for naming your colors. You can uncomment it if you like. The libraries are not needed here, too, so I commented them out.
Here is your figure when the 10mm
is dropped.
And here is one with scaling (not really necessary, just for demonstration purposes).
%\documentclass{article}
\documentclass[border=5]{standalone}
\usepackage{tikz}
%\usepackage{xcolor}
%\usetikzlibrary{arrows,shapes,snakes,automata,backgrounds,petri}
\begin{document}
\begin{tikzpicture}[scale=3]
\draw [rounded corners,fill=gray!20] (0,0)--(1,0)--(0.5,1)--cycle;
\end{tikzpicture}
\end{document}
Here I have scaled the figure up to 3 since your figure is too small.
To make a point, see what happens when I scale the figure up by 5 and set rounded corners=10mm
.
Thank you for your suggestions! I liked the method proposed in the answer Torbjørn T. linked to the most, so I'm answering here myself.
Code:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\fill [blue,draw]
(0,0) --
++(5,0) {[rounded corners=10] --
++(0,5) --
++(-5,0)} --
cycle
{};
\fill [red,draw]
(0,0) --
++(5,0) {[rounded corners=10] --
++(0,-5) --
++(-5,0)} --
cycle
{};
\end{tikzpicture}
\end{figure}
\end{document}
Output:
Best Answer
There are some packages that can help you, for example:
empheq
hf-tikz
and along this site some answers could be a good starting point:
Here, I provide you a MWE using the
hf-tikz
package. Actually\boxed{}
is not used at all, thus I don't know if this will meet your requirements. Notice that, in the following example, it is shown how to highlight the whole equation or just a part of it, that is the major potentiality of the package. You should compile twice to get the right result.Result:
According to the request in the comments, here are the two possibilities to get rigid corners. It is needed the version
0.2
of the package.norndcorners
to have always rigid corners: just loading the package with\usepackage[customcolors,norndcorners]{hf-tikz}
the previous document becomes:shade
option and then use the keydisable rounded corners=true
in thetikzmarkin
command.In this example, the second equation is highlighted with rigid corners while the other two with rounded corners:
The result: