1

I have created vertically split circle and it works standalone but it stop when I add this code to my university template. Here is standalone code:

\documentclass[tikz]{standalone}
% BEGIN section 1 
\usepackage{tikz}
\usetikzlibrary{calc, positioning,fit}
% END section 1
\begin{document}
% BEGIN section 2
\begin{tikzpicture}[scale=1]
\tikzset{
    pics/circle vertically split/.style 2 args = {
       code = {
         \pgfmathsetmacro{\widthOne}{width("#1")+4pt}
         \pgfmathsetmacro{\widthTwo}{width("#2")+4pt}

         \node[text=green](-this_is_currcent_center){+};
         \node[xshift=-\widthOne/2] (-left) {#1};
         \node[xshift=\widthTwo/2] (-right) {#2};
         \node[fit=(-left)(-right),draw,circle,text=red](-shape) {+};
         \node(-splitline) at ($ (-left.east)!.5!(-right.west) $) {};
         \draw (-shape.north east -| -splitline.center) -- (-shape.south east -| -splitline.center);
       }
    }
}
% this doesn't center correctly but it's not part of this question
\pic[inner sep = 1pt, align=left] (A) {circle vertically split={$Aaaaaa$}{$B$}};
\pic[inner sep = 1pt, align=left, right = of A-shape] (B) {circle vertically split={A}{$Bbbbb$}};
\end{tikzpicture}
% END section 2
\end{document}

Standalone code produce: result of standalone code

Error after adding to university template:

! Package PGF Math Error: Unknown function `Aaaaaa' (in 'width(""Aaaaaa"")+4pt' ).

How to reproduce error

For anyone who want to help me I created a quick way to repoduce error in 30s:

  1. Clone repository (this is fork of template) --git clone https://github.com/xoac/aghdpl-imir.git
  2. Checkout to branch split-circle -- git checkout split-circle
  3. Compile with command latexmk -outdir=build -pdf praca.tex

Additional information:

Check difference between raw template and after my changes git diff master split-circle

pdflatex --version:

pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License.
For more information about these matters, see the file named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with poppler version 0.85.0


How can I find why it stopped compiling after adding my code?


I create my vertically split circle mixed this two solutions: 1. https://tex.stackexchange.com/a/528851/192768 2. https://tex.stackexchange.com/a/186506/192768

  • 1
    PD --- notice that you have mispelled --version in your question... – Rmano Feb 20 at 9:49
  • @Rmano Thank you. It's fixed now. – S.R Feb 20 at 10:31
3

The problem is probably that your format is used with

\usepackage[english, polish]{babel}

which transforms the meaning of some special char (technically it makes chars active), in this case probably the quote " which I suppose it is used to add some accent around... (I do not know Polish, so I don't know the details).

If you use utf8 to input special chars, you can try to disable babel shorthands with

 \usepackage[english, polish, shorthands=off]{babel}

or you can try loading the TikZ library

   \usetikzlibrary{babel}

I think that both approaches work in your example.

Problem with babel and tikz using \draw is very similar to this, I suspect.

|improve this answer|||||
  • Both answers works. Thanks. Errors are very unintuitive in latex! – S.R Feb 20 at 10:45

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.