2

I am modifying my logo so that the distance between the first letter and the last letter of the text sequence is not so narrow. Also, I want to replace the scalebox command so that we have bold in both figures and text.

enter image description here

\documentclass[12pt]{article}
\usepackage{amsmath,  latexsym, amscd, amsthm}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric,calc}
\tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
\usepackage{tikz}         % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text}  % altermundus.com/pages/tkz/ornament/ 


\newcommand{\gear}[5]{%
\foreach \i in {1,...,#1} {%
  [rotate=(\i-1)*360/#1]  (0:#2)  arc (0:#4:#2) {[rounded corners=1.5pt]
             -- (#4+#5:#3)  arc (#4+#5:360/#1-#5:#3)} --  (360/#1:#2)
}}  

\usepackage{libertineotf}


\begin{document}


  \scalebox{.4}{
\begin{tikzpicture}[color=black, ultra thick]
\node[my polygon=6,draw,outer sep=0] (a){};
\foreach \x[remember=\x as \xp (initially 6)] in {1,...,6}{
\draw[] (a.corner \xp)
      ..controls ++(60*\x:2cm) ..
        ([shift={({60*(\x+1)+7.35}:1.55cm)}]a.corner \x); % This part needs tweaking for a 
                                                       % nice blend (or a derivative I think).
}

;
\draw \gear{16}{5}{5.2}{10}{2};

\path 
    [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\huge|HEXAGON OF MATHEMATICS AND SCIENCE},
      text align=fit to path,reverse path}, decorate}]
     circle[radius=4.08742cm] ; 

\end{tikzpicture}}

\end{document}
  • Instead of typesetting the text in a circle, do it in a circular arc, which is almost a complete circle. – JLDiaz Oct 7 '15 at 15:02
  • Yes, I can do it now. I used $\dot$ between the text but it did not work. How to add to dots to separate? – Thumbolt Oct 7 '15 at 15:25
  • Btw, I see you load amscd, which doesn't yields very good results, except for very simple diagrams. You should give a try at tikz-cd, if you don't know it. – Bernard Oct 7 '15 at 16:16
4
  1. To separate the start and ending chars of the text you can insert "forced" spaces(i.e: {\ }) at the ends.
  2. To "bold" the lines and text, you cannot use \scalebox. This will scale the whole dimensions of the figure, so preseving the ratio between the line width and the figure widht, so visually it will look the same.

Perhaps your intended approach was to, first reduce the size of the tikz picture using tikz's scale (this will reduce the dimensions without affecting the line widths and text, so making it relatively "bolder") and then scale up the whole tikzpicture using \scalebox. This approach could work, but in this case your figure relies on several "hardcoded" distances which makes this approach unfeasible. Moreover, if you reduce the size of the tikz picture, the text would be too long to fit in the circle.

So, a different approach to make the figure bolder is:

  1. Use \bfseries for the text
  2. Use line width=2mm (for example) for the lines. Note that you also have to set line cap=round, to make the line joints at the gears more smooth.

Using these approaches the result is:

Result

And the code is:

\documentclass[12pt]{standalone}
\usepackage{amsmath,  latexsym, amscd, amsthm}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric,calc}
\tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
\usepackage{tikz}         % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text}  % altermundus.com/pages/tkz/ornament/ 


\newcommand{\gear}[5]{%
\foreach \i in {1,...,#1} {%
  [rotate=(\i-1)*360/#1]  (0:#2)  arc (0:#4:#2) {[rounded corners=1.5pt]
             -- (#4+#5:#3)  arc (#4+#5:360/#1-#5:#3)} --  (360/#1:#2)
}}  

\usepackage{libertineotf}


\begin{document}


\begin{tikzpicture}[color=black, line width=2mm, line cap=round]
\node[my polygon=6,draw,outer sep=0] (a){};
\foreach \x[remember=\x as \xp (initially 6)] in {1,...,6}{
\draw[] (a.corner \xp)
      ..controls ++(60*\x:2cm) ..
        ([shift={({60*(\x+1)+7.35}:1.55cm)}]a.corner \x); % This part needs tweaking for a 
                                                       % nice blend (or a derivative I think).
};
\draw \gear{16}{5}{5.2}{10}{2};
\path 
    [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\huge\bfseries|\ HEXAGON OF MATHEMATICS AND SCIENCE\ },
      text align=fit to path,reverse path}, decorate}]
     circle[radius=4.08742cm] ; 
\end{tikzpicture}

\end{document}

If the text is not enough bolder, you have to resort to a small font size, but then you'll have to adjust the circunference (by scaling the figure) so that the text still fills it.

Edit

The OP asked later in a comment:

I want to add SINCE 2009 within two dots. How can this be done?

The problem is that you cannot change to a math font inside the decoration text (perhaps you cannot change to any font, I'm not sure).

So, if you try using $\bullet$ or $\cdot$, the compiler hangs. I tried also \textbullet, but I guess that this macro internally also tries to switch to a math font, causing the same hang.

But, since you are using libertineotf package, which includes several Unicode glyphs and requires (xe|lua)tex to compile, which uses utf-8 encoded input, you can directly use the char · (U+00B7, centered dot) as part of your text. This char does not cause a font switch, because it is included in the libertine font, so it works. You can also use char (U+2022, bullet), and it also works. How to enter these chars if your keyboard lacks them, depends on your editor. In vim, for example, you have to press Ctrl-V, and then u00b7 o u2022. You can also copy&paste them from this message or any other web page.

So, in your source you'll have:

% In the preamble
\def\mydot{•}  % This is U+2022

 % ...
 % Later ...
 \path 
    [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, 
       text={|\huge|\ HEXAGON OF MATHEMATICS AND SCIENCE \mydot\ SINCE 2009 \mydot\ },
       text align=fit to path,reverse path}, decorate}]
    circle[radius=4.08742cm] ;

To get:

Result2

Update

The source of the problem is not the font switch, as I first thought. As explained in Tikz bug with math in decoration text? the problem is the parsing of the text along a path, which restricts the kind of mathematical expressions that can be used. In particular, they have to be surrounded by braces. So an alternative definition for \mydot which uses the actual math bullet would be:

\def\mydot{{$\bullet$}}

I tested it and it works.

  • I want to add SINCE 2009 within two dots. How can this be done? – Thumbolt Oct 7 '15 at 15:58
  • Could you help with this? – Thumbolt Oct 8 '15 at 5:04
  • @Thumbolt I edited my answer to address this question too. – JLDiaz Oct 8 '15 at 6:54
  • I was trying to replace the \Huge with \scalebox{k} to have bigger text but it did not work. Keep of and and in normal style, and perhaps remove since 2009. Why? – Thumbolt Oct 9 '15 at 6:17
  • @Thumbolt \Huge does not require any parameter. It simply changes the current font (same for \bfseries). \scalebox{k} requires the content of the box to scale as parameter, so it cannot be used like \Huge. Moreover, if you create a box with the text, tikz would not be able to "curve" it around the circle. It needs the individual characters "unboxed". Moreover, if you scale the text, you not only get more height text, but also more width, you also would require a longer circunference to hold it. Perhaps with a different font... Could you provide a "mockup" of the intended result? – JLDiaz Oct 9 '15 at 7:22
1

Simply add a pair of \s at the beginning and end of the text. Strangely \quad, \hskip2mm and things like that make compilation hang.

\documentclass[12pt]{article}
\usepackage{amsmath, latexsym, amscd, amsthm}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric,calc}
\tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
\usepackage{tikz} % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text} % altermundus.com/pages/tkz/ornament/


\newcommand{\gear}[5]{%
\foreach \i in {1,...,#1} {%
  [rotate=(\i-1)*360/#1] (0:#2) arc (0:#4:#2) {[rounded corners=1.5pt]
             -- (#4+#5:#3) arc (#4+#5:360/#1-#5:#3)} -- (360/#1:#2)
}}

\usepackage{libertineotf}


\begin{document}


  \scalebox{.4}{
\begin{tikzpicture}[color=black, ultra thick]
\node[my polygon=6,draw,outer sep=0] (a){};
\foreach \x[remember=\x as \xp (initially 6)] in {1,...,6}{
\draw[] (a.corner \xp)
      ..controls ++(60*\x:2cm) ..
        ([shift={({60*(\x+1)+7.35}:1.55cm)}]a.corner \x); % This part needs tweaking for a
                                                       % nice blend (or a derivative I think).
}

;
\draw \gear{16}{5}{5.2}{10}{2};

\path
    [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\huge|\ HEXAGON OF MATHEMATICS AND SCIENCE\ },
      text align=fit to path,reverse path}, decorate}]
     circle[radius=4.08742cm] ;

\end{tikzpicture}}

\end{document} 

enter image description here

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.