1

I have this code -

\documentclass{scrartcl}
\usepackage[banglamainfont=Akaash,banglattfont=Akaash]{latexbangla}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz
\begin{document}  
\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}   

\begin{center}   
\begin{tikzpicture}[every node/.append style={inner sep=0}]
   \draw [Blue] (-5,-5) rectangle +(10,10);
   \node [anchor=north west] at (-3,5) {\pgfornament[width=6cm]{71}};
   \node [anchor=south west] at (-3,-5) {\pgfornament[width=6cm,,symmetry=h]{71}};
   \node [anchor=north west] at (-5,5) {\pgfornament[width=2cm]{63}};
   \node [anchor=north east] at (5,5) {\pgfornament[width=2cm,,symmetry=v]{63}};
   \node [anchor=south west] at (-5,-5) {\pgfornament[width=2cm,,symmetry=h]{63}};
   \node [anchor=south east] at (5,-5) {\pgfornament[width=2cm,,symmetry=c]{63}};
   \node [anchor=south west,rotate=-90] at (-5,3) {\pgfornament[width=6cm]{46}};
   \node [anchor=south west,rotate=90] at (5,-3) {\pgfornament[width=6cm]{46}};
   \node [Maroon,font=\Huge\bfseries] at (0,0) {কিছু};
   \node [anchor=south] at (0,0.5) {\pgfornament[width=5cm]{69}};
   \node [anchor=north] at (0,-0.5) {\pgfornament[width=5cm,symmetry=c]{69}};
%   \node [anchor=north east,rotate=-30] at (-1,2.5) {\pgfornament[width=2cm]{57}};
%   \node [anchor=north west,rotate=30] at (1,2.5) {\pgfornament[width=2cm,symmetry=v]{57}};

\end{tikzpicture} 
\end{center}

The result is
enter image description here

I want to change my documents so that when I add more text middle of the document(কিছু) the ornaments automatically shifted outer to free the space for the text.

Edit

See the following code and output -

\documentclass{scrartcl}
\usepackage[banglamainfont=Akaash,banglattfont=Akaash]{latexbangla}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz
\begin{document}  
\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}   

\begin{center}   
\begin{tikzpicture}[every node/.append style={inner sep=0}]
   \draw [Blue] (-5,-5) rectangle +(10,10);
   \node [anchor=north west] at (-3,5) {\pgfornament[width=6cm]{71}};
   \node [anchor=south west] at (-3,-5) {\pgfornament[width=6cm,,symmetry=h]{71}};
   \node [anchor=north west] at (-5,5) {\pgfornament[width=2cm]{63}};
   \node [anchor=north east] at (5,5) {\pgfornament[width=2cm,,symmetry=v]{63}};
   \node [anchor=south west] at (-5,-5) {\pgfornament[width=2cm,,symmetry=h]{63}};
   \node [anchor=south east] at (5,-5) {\pgfornament[width=2cm,,symmetry=c]{63}};
   \node [anchor=south west,rotate=-90] at (-5,3) {\pgfornament[width=6cm]{46}};
   \node [anchor=south west,rotate=90] at (5,-3) {\pgfornament[width=6cm]{46}};
   \node [Maroon,font=\huge] at (0,0) {
   শিশুকে \begin{tabular}{ll}
   &ভুল শেখাবেন না&সঠিক শেখাবেন।\\
   &লোভ দেখাবেন না &পুরস্কার দেবেন \\
   &নিরুৎসাহিত করেবন না&উৎসাহিত করেবন\\
   &বকুনি দেবেন না&উপেদশ দেবেন \\
  &বেয়াদব বলেবন না&আদব শেখাবেন \\
   &নিঃসঙ্গ  রাখবেন না&সৎসঙ্গ দেবেন \\
&ভয় দেখাবেন না&সাহস দেবেন \\
&লজ্জা দেবেন না& শিখিয়ে দেবেন \\
&ধমক দেবেন না&বুঝতে দেবেন \\
&মিথ্যা বলবেন না&সত্য বলবেন \\
&বেত্রাঘাত করবেন না &স্নেহ করবেন \\
&নিন্দা করেবন না&ভালবাসবেন \\
&অবেহলা করবেন না&গুরুত্ব দেবেন 
&মাওলানা মুরশিদুল আলম , মুহতামিম\\ 
&জামিয়া আরাবিয়া হাজী ইউনুছ (কওমী মাদ্রাসা)\\
    \end{tabular}
    };

   \node [anchor=south] at (0,0.5) {\pgfornament[width=5cm]{69}};
   \node [anchor=north] at (0,-0.5) {\pgfornament[width=5cm,symmetry=c]{69}};
%   \node [anchor=north east,rotate=-30] at (-1,2.5) {\pgfornament[width=2cm]{57}};
%   \node [anchor=north west,rotate=30] at (1,2.5) {\pgfornament[width=2cm,symmetry=v]{57}};

\end{tikzpicture} 
\end{center}
\end{document} 

enter image description here

EDIT2

In my MWE I use the Bengali text because I make a Bangla documents with ornaments. But, you can use English. And, keep in mind that your solution should works for Bengali also.

May be helpful to answer this question Is there any method to create UML using LaTeX without giving (x,y) co-ordinate?

4
  • Is the Bangla part relevant?
    – Johannes_B
    Mar 8, 2018 at 10:18
  • @Johannes_B no. You can use English also, but keep in mind that your solution also works for Bangla.
    – alhelal
    Mar 8, 2018 at 10:20
  • Please edit the question then.
    – Johannes_B
    Mar 8, 2018 at 10:21
  • @Johannes_B I edited my question.
    – alhelal
    Mar 8, 2018 at 10:26

1 Answer 1

2

First, I'll note that you had some errors in that table code, you defined only two columns, but you used three (the & separate columns, so two & give three columns). There also seemed to be a \\ missing, and possibly a , in one of the lines should be &. I fixed it so that it works, but because I can't read the language, and don't know what it's supposed to look like, I may have messed it up. But you need to fix that yourself.


I would place the text node first, and then place all the ornaments relative to it. I loaded the positioning TikZ-library to help with this. If you have a node named foo, you can place another node next to it with e.g. \node [left=of foo] .. See section 17.5.3 Advanced placement options in the TikZ manual (for version 3.0.1a) for a description of the library.

One thing to note about the anchors of rotated nodes: The anchors also rotate. Hence, for the node containing the ornament on the right side, which has rotate=90, the north anchor is on the left side of the node, not the top.

If you're not familiar with the -| syntax used to position the ornaments in the corner, have a look at TikZ: What EXACTLY does the the |- notation for arrows do?

I also show two different examples. The only difference between the two is that in the second one I calculate the width and height of the central text node, and set the widths of the ornaments relative to these. That is the reason for the different outputs:

output of code

\documentclass{scrartcl}
\usepackage[banglamainfont=Akaash,banglattfont=Akaash]{latexbangla}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz

\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}   

\usetikzlibrary{
  positioning, % for left=of, above=of etc.
  calc % for let syntax used in second example
}

\begin{document}  

\begin{center}   
\begin{tikzpicture}[
  every node/.append style={inner sep=0},
  node distance=5mm
]
   \node [Maroon] (text) {
   \begin{tabular}{ll}
     শিশুকে \\
     ভুল শেখাবেন না&সঠিক শেখাবেন।\\
     লোভ দেখাবেন না &পুরস্কার দেবেন \\
     নিরুৎসাহিত করেবন না&উৎসাহিত করেবন\\
     বকুনি দেবেন না&উপেদশ দেবেন \\
     বেয়াদব বলেবন না&আদব শেখাবেন \\
     নিঃসঙ্গ  রাখবেন না&সৎসঙ্গ দেবেন \\
     ভয় দেখাবেন না&সাহস দেবেন \\
     লজ্জা দেবেন না& শিখিয়ে দেবেন \\
     ধমক দেবেন না&বুঝতে দেবেন \\
     মিথ্যা বলবেন না&সত্য বলবেন \\
     বেত্রাঘাত করবেন না &স্নেহ করবেন \\
     নিন্দা করেবন না&ভালবাসবেন \\
     অবেহলা করবেন না&গুরুত্ব দেবেন \\
     মাওলানা মুরশিদুল আলম & মুহতামিম\\ 
     জামিয়া আরাবিয়া হাজী ইউনুছ (কওমী মাদ্রাসা)
    \end{tabular}
    };

  \node [anchor=north] (below) at (text.south) {\pgfornament[width=5cm,symmetry=c]{69}};
  \node [anchor=south] (above) at (text.north) {\pgfornament[width=5cm]{69}};

   \node [rotate=-90, left=of text, anchor=north] (left)  {\pgfornament[width=6cm]{46}};
   \node [rotate=90, right=of text, anchor=north] (right) {\pgfornament[width=6cm]{46}};

   \node [above=of above] (top)    {\pgfornament[width=6cm]{71}};
   \node [below=of below] (bottom) {\pgfornament[width=6cm,symmetry=h]{71}};

   \node [anchor=north west] at (top.north -| left.south)  {\pgfornament[width=2cm]{63}};
   \node [anchor=north east] at (top.north -| right.south) {\pgfornament[width=2cm,symmetry=v]{63}};
   \node [anchor=south west] at (bottom.south -| left.south) {\pgfornament[width=2cm,symmetry=h]{63}};
   \node [anchor=south east] at (bottom.south -| right.south) {\pgfornament[width=2cm,symmetry=c]{63}};

   % draw frame
  \draw [Blue] (current bounding box.south west) rectangle (current bounding box.north east);

\end{tikzpicture} 


\begin{tikzpicture}[
  every node/.append style={inner sep=0},
  node distance=5mm
]
   \node [Maroon] (text) {
   \begin{tabular}{ll}
     শিশুকে \\
     ভুল শেখাবেন না&সঠিক শেখাবেন।\\
     লোভ দেখাবেন না &পুরস্কার দেবেন \\
     নিরুৎসাহিত করেবন না&উৎসাহিত করেবন\\
     বকুনি দেবেন না&উপেদশ দেবেন \\
     বেয়াদব বলেবন না&আদব শেখাবেন \\
     নিঃসঙ্গ  রাখবেন না&সৎসঙ্গ দেবেন \\
     ভয় দেখাবেন না&সাহস দেবেন \\
     লজ্জা দেবেন না& শিখিয়ে দেবেন \\
     ধমক দেবেন না&বুঝতে দেবেন \\
     মিথ্যা বলবেন না&সত্য বলবেন \\
     বেত্রাঘাত করবেন না &স্নেহ করবেন \\
     নিন্দা করেবন না&ভালবাসবেন \\
     অবেহলা করবেন না&গুরুত্ব দেবেন \\
     মাওলানা মুরশিদুল আলম & মুহতামিম\\ 
     জামিয়া আরাবিয়া হাজী ইউনুছ (কওমী মাদ্রাসা)
    \end{tabular}
    };



  \path 
    let
    \p1=(text.south west),
    \p2=(text.north east),
    \n1={\x2-\x1}, % width of text node
    \n2={\y2-\y1}  % height of text node
    in
% in all of the below some fraction of \n1 or \n2 is used to define the width of the ornaments
% set width of these ornaments to half the text node's width
   node [anchor=north] (below) at (text.south) {\pgfornament[width=0.5*\n1,symmetry=c]{69}}
   node [anchor=south] (above) at (text.north) {\pgfornament[width=0.5*\n1]{69}}
% use \n2 for ornament width here
   node [rotate=-90, left=of text, anchor=north] (left)  {\pgfornament[width=\n2]{46}}
   node [rotate=90, right=of text, anchor=north] (right) {\pgfornament[width=\n2]{46}}
% and \n1 here
   node [above=of above] (top)    {\pgfornament[width=\n1]{71}}
   node [below=of below] (bottom) {\pgfornament[width=\n1,symmetry=h]{71}}
% and 25% of width for the corner ornaments
   node [anchor=north west] at (top.north -| left.south)  {\pgfornament[width=0.25*\n1]{63}}
   node [anchor=north east] at (top.north -| right.south) {\pgfornament[width=0.25*\n1,symmetry=v]{63}}
   node [anchor=south west] at (bottom.south -| left.south) {\pgfornament[width=0.25*\n1,symmetry=h]{63}}
   node [anchor=south east] at (bottom.south -| right.south) {\pgfornament[width=0.25*\n1,symmetry=c]{63}}; % <- note the \path doesn't end until here

   % draw frame
  \draw [Blue] (current bounding box.south west) rectangle (current bounding box.north east);

\end{tikzpicture} 
\end{center}
\end{document} 
1
  • Yes, reading Bangla for you is difficult. Actually there are some good advice from a wise man for the parents of children. I will try to give a English translated copy of this.
    – alhelal
    Mar 8, 2018 at 15:36

You must log in to answer this question.

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