-2

If possible I want to draw a code figure (looks like rectangle but right-top corner is trimmed) in tikz. Basic sample would be:

____
|   \
|< >|   
|___|

Is there any sample for this?

Original figure is taken from : https://git-lfs.com

enter image description here

alper
  • 1,389

3 Answers3

4

There is also the chamfered rectangle node shape:

enter image description here

\documentclass{article}

\usepackage{tikz} \usetikzlibrary{shapes.misc}

\tikzset{fileshape/.style 2 args={chamfered rectangle, draw, ultra thick, chamfered rectangle corners=north east, minimum height=12mm, minimum width=10mm, #1, label={[text=#1]270:{\sffamily #2}} }}

\begin{document}

\begin{tikzpicture} \node[fileshape={gray}{code}]at (0,0) (A){$<>$}; \node[fileshape={cyan}{file.psd}]at (2,0) (B){}; \draw[thick, gray] (A)--(B); \end{tikzpicture}

\end{document}

Sandy G
  • 42,558
3

Like so?

icon

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{tikz}

\begin{document} \begin{tikzpicture}[line width=3pt] \draw (2.3,6.5) -- (-4.3,6.5) -- (-4.3,-6.6) -- (4.3,-6.6) -- (4.3,3.7) -- cycle; \draw (-.9,1.6) -- (-2.9,0) -- (-.9,-1.6); \draw (.9,1.6) -- (2.9,0) -- (.9,-1.6); \end{tikzpicture} \end{document}

Try also these:

    \draw (1.5,3.25) -- (-2.65,3.25) -- (-2.65,-3.3) -- (2.85,-3.35) -- (2.85,1.85) -- cycle;
    \draw (-.45,.8) -- (-1.45,-.25) -- (-.55,-1.3);
    \draw ( .45,.8) -- ( 1.45,-.25) -- ( .55,-1.3);
MS-SPO
  • 11,519
  • 1
    Thanks! Having a filled folded paper inside another folded paper would be challenging right? like most right figure on my question – alper May 27 '23 at 16:04
  • Not really. See https://tex.stackexchange.com/a/686934/245790 . – MS-SPO May 27 '23 at 16:42
3

Here's a way to draw both icons.

The initial idea was to follow the curves for the schematized person. However, it turned out, that's not necessary and you can also put a circle at the right position, as long as the path is closed.

As was pointed out in the link inside one comment, it might be useful to use polar coordinates with the cut corners.

Also scale is rather large. Best way would be to adjust the coordinates using a calculator (or tikzlib calc) rather than using scale (see manual for details).

result

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{tikz}

\begin{document} % ~~~ pictures ~~~~~~~~~ \tikzset{ symb/.pic={ \draw (1.5,3.25) -- (-2.65,3.25) -- (-2.65,-3.3) -- (2.85,-3.35) -- (2.85,1.85) -- cycle; \draw (-.45,.8) -- (-1.45,-.25) -- (-.55,-1.3); \draw ( .45,.8) -- ( 1.45,-.25) -- ( .55,-1.3); } } \tikzset{ pers/.pic={ \draw (1.5,3.25) -- (-2.65,3.25) -- (-2.65,-3.3) -- (2.85,-3.35) -- (2.85,1.85) -- cycle; \draw [fill=black] (1.05,1.95) -- (-1.95,2) -- (-1.95,-2) -- (-0.95, -2) arc [start angle=180,end angle=90,radius=1cm] -- ++(0,0) arc [start angle=270,end angle=-90,radius=1cm] -- ++ (0,0) arc [start angle=90,end angle=0,radius=1cm] -- (2.05,-2) -- (2.05,1) -- cycle; } } % ~~~ demo ~~~~~~~~~~~~~~~~ \begin{tikzpicture}[line width=3pt] \pic at (0,0) {symb}; \pic at (6,0) {pers};

\pic at (12,-9) {pers};

\end{tikzpicture} \end{document}

P.S.: This happens, when you add a white outline to the circles of pers:

---
\draw [fill=black,draw=white] (1.05,1.95) -- (-1.95,2)   ...

result2

MS-SPO
  • 11,519