3

i want to draw 4 milk carton like attachment. Please help Example: Create water cup symbol this code for water:

\documentclass{article}

\usepackage[most]{tcolorbox}

\makeatletter
\tcbset{
        myvbox/.style 2 args={%
        enhanced, 
        colback=white,
        colframe=blue!30!black,
        left=8mm,
        overlay={
            \node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
            \path[fill=tcbcol@frame] ([email protected] west)--([email protected] east) 
                to[out=90, in=270] ([yshift=5mm][email protected])--
                ([email protected]|-frame.north)
                [rounded corners=\kvtcb@arc] -| 
                (frame.west) |- ([email protected])[sharp corners] -- cycle;   
            \node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
        },
        #1
    },  
}
\makeatother

\newcommand{\mycup}{%
    \begin{tikzpicture}
        \draw (0,1.2) -- (0.2,0) -- (0.6,0) -- (0.8,1.2);
        \draw[blue] (0.05,1) -- (0.1,1.1) -- (0.2,1) -- (0.3,1.1) -- (0.4,1)-- (0.5,1.1) -- (0.6,1) -- (0.7,1.1) -- (0.75,1);
    \end{tikzpicture}%
    \hspace{1em}%
}

\begin{document}

\begin{tcbposter}[poster = {columns=1, rows=1, width=0.5\textwidth, height=0.5\textheight,spacing=0.1mm}]
    \posterbox[height=3cm,width =10cm, myvbox={colframe=blue!80!black}{Milk carton}]{column=1, row=1,  xshift=0cm, yshift=1cm}{%
        \mycup\mycup\mycup\\
        \mycup\mycup\mycup
    }
\end{tcbposter}

\end{document}

enter image description here

4

2 Answers 2

12
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\definecolor{myWhite}{HTML}{f7f7f7}
\definecolor{myGr1}{HTML}{c6c6c6}
\definecolor{myGr2}{HTML}{e3e3e3}
\definecolor{myCy}{HTML}{0396C1}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[scale=0.4]
%front
\fill[myWhite] (4.3,-17.6) -- (-9.5,-14.25) -- (-9.5,8.2) -- (4.3,5.75) -- cycle;
\path[decorate, decoration={text effects along path,
text={MILK},
text align=center,
text effects/.cd,
characters={text along path, scale=5,xslant=-.2},
fit text to path
}] (-8.8,-3.82) -- (3,-6.36);%MILK
\path[decorate, decoration={text effects along path,
text={package},
text align=center,
text effects/.cd,
characters={text along path, scale=3,xslant=-.2,text=cyan},
fit text to path
}] (-7.1,-5.95) -- (1.9,-8.02);%package
%upper
\fill[myGr2] (-1,10.6) -- (12.5,8.35) --  (4.3,5.75)  -- (-9.5,8.2) -- cycle;
%lateral
\fill[myGr1] (12.5,-14.25) -- (12.5,8.35) -- (4.3,5.75) -- (4.3,-17.6) -- cycle;
%hole
\draw[fill=gray] (-6.1,8.6) .. controls (-6.5,8.5) and (-6.2,8.2) .. (-5.5,8.2) .. controls (-4.9,8.2) and (-4.4,8.4) .. (-4.8,8.6)-- cycle;
%fold lateral 1
\draw (4.3,5.75)-- (8.1,1.2) -- (9,1.5) -- (9,2.7) -- (12.5,8.35);
%fold lateral 2
\fill[myGr1!90] (8,7) -- (8.1,1.2) -- (9,1.5) -- (9,2.7) -- (9.03,7.42) -- cycle;
%fold upper
\fill[myGr2!55]  (-4.46,9.79) -- (-5.42,9.43)-- (8,7) -- (9.03,7.42) -- cycle ;
%straw
\shade[inner color=myCy!50,outer color=myCy] (-4.8,8.4) -- (-4.9,15.6) -- (-4.7,15.7) -- (-4.9,16) -- (-4.8,16.1) -- (-5,16.4) -- (-4.9,16.5) -- (-5.2,16.7) -- (-5.1,16.8) -- (-5.4,17) -- (-5.4,17.1) -- (-5.7,17.2) -- (-5.7,17.4) -- (-6,17.4) -- (-6.1,17.6) -- (-6.4,17.5) -- (-6.48,17.7) -- (-6.7,17.6) -- (-6.9,17.7) -- (-7.1,17.6) -- (-7.3,17.7) -- (-7.5,17.5) -- (-7.7,17.6) -- (-7.9,17.3) -- (-17.7,11.6) -- (-17.2,10.6) -- (-7.2,16.3) -- (-7.14,16.21) -- (-7.07,16.32)  -- (-6.98,16.24)  -- (-6.91,16.34)  -- (-6.85,16.3) -- (-6.79,16.35) -- (-6.72,16.27) -- (-6.64,16.33)  -- (-6.58,16.24)  -- (-6.5,16.28) -- (-6.48,16.2) -- (-6.4,16.2) -- (-6.4,16.1) -- (-6.3,16.1) -- (-6.31,16) -- (-6.18,16.01)-- (-6.23,15.89)-- (-6.13,15.85)-- (-6.21,15.76)-- (-6.06,15.73)-- (-6.13,15.64)-- (-6.05,15.56)-- (-6,8.4);
\end{tikzpicture}
\end{document}

milk package TikZ

5
  • 1
    Wow! This looks so real! Jan 18, 2019 at 23:19
  • 1
    @samcarter I make it coping the original image using TikzEdt. It's easy.
    – vi pa
    Jan 18, 2019 at 23:27
  • 1
    +1. You could in principle also use the 3d library to project the text on an appropriate plane.
    – user121799
    Jan 19, 2019 at 3:03
  • Thank so much. 3D exellent
    – latexforti
    Jan 28, 2019 at 14:39
  • I've copy your image using TikzEdt. It's very useful for copy an image, but you must even know PGF/Ti_k_Z for get a better result.
    – vi pa
    Jan 29, 2019 at 19:21
2
\documentclass[tikz]{standalone}

\begin{document}


\begin{tikzpicture}[yscale=-0.1,xscale=0.1]

\fill[gray!10!white] (187.98,83.66) -- (315.02,106.06) -- (315.02,256.34) -- (187.98,233.94) -- cycle ;
\fill[gray!30!white] (382,244.53) -- (315.02,256.34) -- (315.02,106.06) -- (382,94.25) -- cycle ;
\fill[gray!40!white] (254.96,71.85) -- (382,94.25) -- (315.02,106.06) -- (187.98,83.66) -- cycle ;
\fill[gray!40!white] (315.02,106.06) -- (358,134) -- (382,94.25) -- cycle ;
\draw[blue,line width=20pt]    (196.5,56.5) .. controls (226,22) and (247,-46) .. (245,84) ;



\end{tikzpicture}
\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .