2

I have difficulty in the use of tikz package. I want to be like the output below. Please heip me! Thank you very much!

enter image description here

3
  • It seems to be much more than minipage. Maybe you should look around for a calss.
    – Enlico
    Oct 27, 2016 at 14:39
  • 1
    Please do NOT edit your question to include an answer - especially not an answer you've just copied from one of the answers to your original question. Doing so makes the existing answers make no sense and doing so without even bothering to attribute the code to its author is extremely rude when people have spent a good deal of time to help you despite your apparently making no effort to help yourself before or after asking your question.
    – cfr
    Nov 1, 2016 at 3:11
  • Take a look at: tex.stackexchange.com/a/324218/1952
    – Ignasi
    Nov 2, 2016 at 16:50

2 Answers 2

7

First of all, read tutorial 1 in pgfmanual. After that you will understand how to draw this simple graphic.

Second, take a look at tcolorbox documentation and you'll see how to format this kind of boxes.

After that, try to understand following code and you'll be able to adapt it to your needs:

\documentclass[twocolumn]{article}
\usepackage[most]{tcolorbox}
\usetikzlibrary{arrows.meta}
\usepackage{lipsum}

\newtcolorbox{boxone}{%
    enhanced,
    colback=brown!10,
    boxrule=0pt,
    sharp corners,
    frame hidden,
    fontupper=\bfseries,
    notitle,
    overlay={%
        \draw[Circle-Circle, brown!70!black, line width=2pt](frame.north west)--(frame.south west); 
        \draw[Circle-Circle, brown!70!black, line width=2pt](frame.north east)--(frame.south east);}
    }

\newtcolorbox{boxtwo}{%
    enhanced,
    %frame style={draw=none},
    colback=orange!20,
    boxrule=0pt,
    sharp corners,
    frame hidden,
    notitle,
    overlay={%
        \draw[{Triangle[right]}-{Triangle[left]}, , line width=2pt](frame.north west)--(frame.north east); 
        \draw[{Triangle[left]}-{Triangle[right]}, , line width=2pt](frame.south west)--(frame.south east);}
    }

\newtcolorbox{boxthree}[2][]{%
    enhanced,
    %frame style={draw=none},
    colback=orange!10,
    colbacktitle=orange!10,
    boxrule=0pt,
    fonttitle=\Large\bfseries,
    coltitle=brown!30!black,
    sharp corners,
    frame hidden,
    title=#2,
    overlay={%
        \draw[thick, brown!70!black, double=orange, double distance=2pt] (frame.north west)--(frame.north east); 
        \draw[thick, brown!70!black, double=orange, double distance=2pt] (frame.south west)--(frame.south east);
        \fill[red!50!brown] ([shift={(3mm,.5mm)}]title.south west)--([shift={(-3mm,0mm)}]title.south east)--([shift={(3mm,-.5mm)}]title.south west)--cycle;}
    }

\begin{document}
\begin{boxone}
\lipsum[1]
\end{boxone}

\begin{boxtwo}
\lipsum[3]
\end{boxtwo}

\begin{boxthree}{Nice maths}
\[\sin^2 x + \cos^2 = 1\]
\end{boxthree}

{\par\centering
\begin{tikzpicture}
\draw[help lines, dotted] (0,0) grid (7,4);
\draw[cyan] (1,1) node[below left, black] {$B$}--node[above left]{$c$} (2,3) node[above, black]{$A$}--node[above right]{$b$} (6,1) node[below right, black]{$C$}--node[below]{$c'$}(2,1) node[below,black]{$H$}--node[below]{$b'$}(1,1)--cycle;
\draw[violet] (2,1)--node[right]{$h$}(2,3);
\draw[violet] (2,1.2)-|(2.2,1);
\draw[thin] (1,.9)--++(-90:.8) (6,.9)--++(-90:.8);
\draw[LaTeX-LaTeX] (1,.3)-- node[fill=white]{$a$}(6,.3);
\end{tikzpicture}
\par}

\end{document}

enter image description here

7
  • The above code generates the error: ''pgfkeys Erros:I do not know the key '/tcb/shap corners',...'' Oct 28, 2016 at 7:33
  • Please help me! Oct 28, 2016 at 7:34
  • @tranhoang150488 You probably have an old tcolorbox version. Update it.
    – Ignasi
    Oct 28, 2016 at 7:41
  • Thank you very much! Now, how to get “LaTeX” symbol in document{book}?? Oct 28, 2016 at 8:25
  • @tranhoang150488 This is another question, but ... \LaTeX or tex.stackexchange.com/questions/11095/…
    – Ignasi
    Oct 28, 2016 at 8:41
3

You do not show what have tried. But have a look at the following code. It will give you a possible starting point.

\documentclass[a4paper,12pt,twocolumn]{article}
\usepackage{amsmath,tcolorbox,tikz}
\begin{document}
\foreach \y in {1,...,34} {
\begin{tcolorbox}
This is a \textbf{tcolorbox}.
\end{tcolorbox}
\begin{tcolorbox}
This is another \textbf{tcolorbox}.
\end{tcolorbox}
\begin{tcolorbox}[title= My nice title]
\foreach \z in {1,...,10} {This is a long \textbf{tcolorbox}.}
\end{tcolorbox}
}
\end{document} 

enter image description here

You must log in to answer this question.

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