3

I have this MWE:

\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{vmargin}
\usepackage{fancyhdr}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}

\setpapersize{A4}
\setmargins{2.2cm}
{0.5cm}
{16.5cm}
{23.42cm}               
{30pt}
{1cm}
{0pt}
{2cm}   

\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}
\fancyhf{}
\cfoot{\large \thepage}
\fancyfoot[RO,LE]{
\definecolor{micolor}{RGB}{191,14,50}
\def\sc{0.15}
\vspace{-8.85mm}
\begin{tikzpicture}[inner sep =0,outer sep=0,line width={0.6*\sc cm},scale=\sc]
    \draw[micolor,line width={0.8*\sc cm}] (23.6cm,2.45cm)--(23.6cm,-2.5cm); % Vertical line of "B"
    \draw[fill,micolor, line width={0.3*\sc cm}]
    (23.197cm,1.9cm)--
    (24.8cm,1.9cm) arc(90:-90:1.6cm and 0.943cm) --
    (23.35cm,0.015cm) --
    (23.35cm,-0.2cm) --
    (25.197cm,-0.2cm)  arc(-90:90:1.8cm and 1.3cm) --
    (23.197cm, 2.4cm);     % Upper belly of "B"
    \draw[fill,micolor,line width={0.3*\sc cm},rotate=180]
    (-23.197cm,1.9cm)--
    (-24.8cm,1.9cm) arc(90:-90:-1.8cm and 0.943cm) --
    (-23.35cm,0.015cm) --
    (-23.35cm,-0.2cm) --
    (-25.197cm,-0.2cm)  arc(-90:90:-2cm and 1.3cm) --
    (-23.197cm, 2.4cm);    % Lower belly of "B"
\end{tikzpicture}
}

\begin{document}
B
\end{document}

As you can see, I am trying to make the letter "B" as similar as possible to an already given one, but it does not remain identical to me.

Letter B

The image on the right is what I created, and the left is what it should look like.

Keep in mind what you can not modify:

  • The scale of the letter.
  • The thickness of each part.
  • The ymin of the vertical line (-2.5 cm) and the ymax (2.45 cm). If by design issue you have to modify the width of the letter you can add or remove a few millimeters (that is, lengthen or shrink the bellies).

Please, can you help me improve that style?

Thanks!

  • 3
    What's the purpose of the exercise? Where does the left B comes from? – Heiko Oberdiek Mar 26 '18 at 23:35
  • 1
    Off-topic: don't use vmargin. Use geometry or one of the other alternatives instead. Why don't you just use the relevant font to make the 'B' or include it as an image, if that's all you've got? – cfr Mar 26 '18 at 23:35
  • 1
    Are you aware of this post. You can use convert to convert the pic to pnm and then inkspace to make a vector graphics from it or convert it to PSTricks ot TikZ. If you are confused about arcs, it might be better to ask a different question. – marmot Mar 26 '18 at 23:45
  • 2
    I doubt that there are perfect arcs. For a better approximation you would need Bezier curves instead. – Heiko Oberdiek Mar 27 '18 at 0:13
  • 1
    @manooooh I think it is a useful question because you can grow ducks in the B, please see my update. ;-) – marmot Mar 27 '18 at 2:22
4

Just for fun and because marmots like ducks, here are some arcs that give an OK fit to the letter. BTW, you should not call your macros \sc because that is already taken. And it is true what all the senior people like Heiko and cfr say. (B.png is just a screen shot of the left B of the question.)

enter image description here

\documentclass[tikz]{standalone}
\definecolor{micolor}{RGB}{191,14,50}
\begin{document}
\begin{tikzpicture}
\node at (-8,0) {\includegraphics[width=5cm]{B.png}};
\fill[even odd rule,micolor]
(-2.1,-2.8) -- (-2.1,2.6) -- (0.85,2.6) arc (90:-70:1.25 and 1.28) 
arc (70:-90:1.54 and 1.5) --cycle
 (-1.2,-2) -- (-1.2,-0.3) -- (0.6,-0.3) arc(90:-90:0.8 and 0.85) --cycle
(-1.2,0.38) -- (-1.2,1.82) -- (0.6,1.82) arc(90:-90:0.6 and 0.72) --cycle;
\end{tikzpicture}

\begin{tikzpicture}
\node at (0,0) {\includegraphics[width=5cm]{B.png}};
\fill[even odd rule,blue,opacity=0.4]
(-2.1,-2.8) -- (-2.1,2.6) -- (0.85,2.6) arc (90:-70:1.25 and 1.28) 
arc (70:-90:1.54 and 1.5) --cycle
 (-1.2,-2) -- (-1.2,-0.3) -- (0.6,-0.3) arc(90:-90:0.8 and 0.85) --cycle
(-1.2,0.38) -- (-1.2,1.82) -- (0.6,1.82) arc(90:-90:0.6 and 0.72) --cycle;
\end{tikzpicture}

\end{document}

enter image description here

As you see in the overlay, the fit is at best OK. One difference to your drawing is that I draw the contours differently and that not all arcs run from -90 to 90.

And here is why redrawing some characters with TikZ might eventually be useful. You can shade them, vary the colors along the fill, and do lots of other things like hiding ducks in the letters.

\documentclass[tikz]{standalone}
\usepackage{tikzducks}
\usetikzlibrary{shadings,fadings}
\definecolor{micolor}{RGB}{191,14,50}
\begin{document}
\begin{tikzpicture}
\begin{scope}[xshift=0cm]
\shade[even odd rule,top color=micolor,bottom color=blue]
(-2.1,-2.8) -- (-2.1,2.6) -- (0.85,2.6) arc (90:-70:1.25 and 1.28) 
arc (70:-90:1.54 and 1.5) --cycle
 (-1.2,-2) -- (-1.2,-0.3) -- (0.6,-0.3) arc(90:-90:0.8 and 0.85) --cycle
(-1.2,0.38) -- (-1.2,1.82) -- (0.6,1.82) arc(90:-90:0.6 and 0.72) --cycle;
\end{scope}
\begin{scope}[xshift=5cm]
\fill[even odd rule,micolor]
(-2.1,-2.8) -- (-2.1,2.6) -- (0.85,2.6) arc (90:-70:1.25 and 1.28) 
arc (70:-90:1.54 and 1.5) --cycle
 (-1.2,-2) -- (-1.2,-0.3) -- (0.6,-0.3) arc(90:-90:0.8 and 0.85) --cycle
(-1.2,0.38) -- (-1.2,1.82) -- (0.6,1.82) arc(90:-90:0.6 and 0.72) --cycle;
\node at(-0.4,1.1){\tikz[xscale=-1]{\duck}};
\fill[micolor] (-1.2,1.82) -- (-1.2,0.38) -- (0.5,0.38) -- 
(0.5,-0.3) -- (-2.1,-0.3) -- (-2.1,-1.82) -- cycle; 
\node at(-0.5,-1.2){\tikz[xscale=-1]{\duck}};
\fill[micolor] (-1.2,-0.3) -- (-1.2,-2) -- (0.5,-2) -- 
(0.5,-2.8) -- (-2.1,-2.8) -- (-2.1,-0.3) -- cycle; 
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

  • It's very good! As much as it is the most basic programming that includes, it helps me a lot. The only thing I had to add to the code was \fill[xshift = 25.197cm, ... since I have more letters and it was not positioned correctly in the right place. I wish I could put ducklings! It's for a college work... Regards – manooooh Mar 27 '18 at 3:30
  • 1
    @manooooh Even though it does not produce a different result, I'd suggest that you put the thing in a scope \begin{scope}[xshift=...] ... \end{scope}. – marmot Mar 27 '18 at 4:14
  • I will consider that, dear @marmot ^-^ – manooooh Mar 27 '18 at 13:37

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.