I have difficulty in the use of tikz package. I want to be like the output below. Please heip me! Thank you very much!
2 Answers
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}
-
The above code generates the error: ''pgfkeys Erros:I do not know the key '/tcb/shap corners',...'' Oct 28, 2016 at 7:33
-
-
@tranhoang150488 You probably have an old tcolorbox version. Update it.– IgnasiOct 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/…– IgnasiOct 28, 2016 at 8:41
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}
minipage
. Maybe you should look around for a calss.