2

i want to create beautiful box with parallel line. Please see attached image

My minimal Coding:

\documentclass[a4paper,8pt]{article}
\usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage[most]{tcolorbox}
%\usepackage{tikz}
\usepackage{adjustbox} 

\tikzset{fancytitle/.style ={fill=red, text=white}}


  \newtcolorbox{Mybox}[2][]{enhanced,
    arc=4mm,
  colframe=blue!80!red,colback=white,colbacktitle=blue!5!yellow!50!white,
  fonttitle=\bfseries,coltitle=black,
  title={#2},
  #1}

  \begin{document}

 \begin{Mybox}[width=5.4cm,height=2.4cm]{Title}
    \begin{center}

abc xyz
\end{center}
 \end{Mybox}
  \end{document}

enter image description here

3
  • 2
    Remove \usepackage[tikz], which is unnecessary and has an incorrect syntax ([...] instead of {...}).
    – user194703
    Aug 20 '19 at 11:09
  • 2
    See tex.stackexchange.com/a/239841.
    – user194703
    Aug 20 '19 at 11:18
  • 1
    On page 4 of the manual of the frcursive package, there is a macro that draws lines as in a Seyes notebook. I don't know TeX well enough to be able to adapt it. ctan.org/pkg/frcursive?lang=en
    – AndréC
    Aug 20 '19 at 11:57
4

This is to a large extent copied from here but the \parshape stuff is inserted automatically with before upper. Of course, you can adjust the dimensions as you like and may change the number of lines of \parshape accordingly.

\documentclass[a4paper,8pt]{article}
\usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage[most]{tcolorbox}

\newtcolorbox{Mybox}[2][]{%
enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1,-2) 
   -- ++ (-0.5,0.3) -- ++ (-0.5,-0.3) -- cycle;
  \node[anchor=north west,text width=1cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
colframe=blue!80!red,colback=white,
width=\textwidth, 
before upper ={\parshape 5
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
1.2cm \dimexpr \hsize-1.2cm\relax
0pt \hsize} ,#1}
\begin{document}
\begin{Mybox}[width=5.4cm]{abc xyz}
some text some text some text some text some text some text some text some text
some text some text some text some text some text some text some text some text
some text some text some text some text some text 
\end{Mybox}
\end{document}

enter image description here

If you want literally horizontal lines, you can use \hrulefill. (However, in this case you may be better off without tcolorbox and draw the thing simply in plain TikZ.)

\documentclass[a4paper,8pt]{article}
\usepackage[left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage[most]{tcolorbox}
\newcounter{ic}
\newtcolorbox{Mybox}[2][]{%
enhanced,top=0mm,left=2pt,right=2pt,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
  overlay unbroken and first={%
  \draw[fill=yellow]
   ([xshift=6pt,yshift=12pt]frame.north west) -| ++ (1.6,-1.3) 
   -- ++ (-0.8,0.3) -- ++ (-0.8,-0.3) -- cycle;
  \node[anchor=north west,text width=1.6cm-4pt,align=center] at ([xshift=6pt,yshift=12pt]frame.north west) 
  {#2}; 
},
breakable,arc=4mm,
colframe=blue!80!red,colback=white,
width=\textwidth,#1}
\begin{document}
\begin{Mybox}[width=5.4cm]{abc xyz}
\vphantom{X}\hspace{1.8cm}\hrulefill{}\par 
\hspace{1.8cm}\hrulefill{}\par 
\hrulefill{}\par 
\hrulefill{}\par 
\hrulefill{}
\end{Mybox}
\end{document}

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.