1
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{rec} = [rectangle, rounded corners , minimum height=1.5cm,text centered, draw,fill={rgb,255:red,255; green,255; blue,225}]

\begin{document}
\begin{tikzpicture}[node distance=2cm]

\node (start) [rec] {\textbf{M3 Cortex MCU \\STM32F103}};
\end{tikzpicture}
\end{document}

enter image description here

So I am trying to create this style like on below but I can not add shadow,border like this nor make text to be like this.Any suggestion :( 2

4
  • \sffamily will make the font sans serif, which is one of your issues. Apr 12 '21 at 18:54
  • To get multiple lines, you can stack the text in the node: \usepackage[usestackEOL]{stackengine} and then: \node (start) [rec] {\sffamily\textbf{\Centerstack{M3 Cortex MCU \\STM32F103}}}; Apr 12 '21 at 18:56
  • @StevenB.Segletes Okay thanks I fixed that and set width but I still can not figure out how to make this boreder and this shade.
    – user239512
    Apr 12 '21 at 19:00
  • @StevenB.Segletes do you know any tutorial or some kind of post,example that could help me
    – user239512
    Apr 12 '21 at 19:22
0

I know very little about tikz. But I know if you search this site, you can often solve your problem by finding similar examples. Modification from the OP's code involve border, shadow, stacking text in the node, inner sep, \sffamily, etc.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[usestackEOL]{stackengine}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{fadings}
\usetikzlibrary{shadows.blur}
\newlength{\borderwidth}
\setlength{\borderwidth}{2mm}
\tikzstyle{rec} = [rectangle, rounded corners , minimum height=1.5cm,
  text centered, border = blue!70!red, inner sep=10pt,
  blur shadow={shadow blur steps=5},
  draw,fill={rgb,255:red,255; green,255; blue,225}]

\tikzset{
border/.style = {
    postaction = {clip, postaction = {draw = #1, solid, 
    line width = \borderwidth, path fading=west, 
    postaction={draw, path fading = north}},
    }
}}

\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node (start) [rec] {\sffamily\bfseries
  \Centerstack{M3 Cortex MCU \\STM32F103}};
\end{tikzpicture}
\end{document}

enter image description here

0

If this box is not to be placed inside a tikzpicture, it can be built with a tcbox from tcolorbox.

More or less:

\documentclass{article}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shadings}

\newtcbox{nicebox}[1][]{%
    enhanced, notitle, boxrule=2mm, fontupper=\sffamily\bfseries,
    frame style={upper left=red!70!blue!50!white, 
    upper right=red!70!blue!40!white,
    lower left=red!60!blue!40!white,
    lower right=red!50!blue!30!white},
    drop fuzzy shadow,
    colback={rgb,255:red,255; green,255; blue,225},
    tikznode,
    #1
}

\begin{document}

\nicebox{M3 Cortex MCU\\STM32F103}

\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