Portál AbcLinuxu, 6. května 2024 01:40


Dotaz: Latex Tikz se "nesnese" s balikem babel

9.12.2011 19:53 Moriarty
Latex Tikz se "nesnese" s balikem babel
Přečteno: 1183×
Odpovědět | Admin

Ahoj, potřebuju poradit s chybou, která se mi vypisuje při použití balíku "tikz" společně s balíkem "babel".

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel} %nelze pouzit! (vadi mu spec znak |- )

\usepackage{amsmath} % nice math symbols
\usepackage{bm} % bold math

\usepackage{tikz}
\usetikzlibrary{arrows} % for arrow heads


% TikZ styles for drawing
\tikzstyle{block} = [draw,rectangle,thick,minimum height=1cm,minimum width=2cm]
\tikzstyle{sum} = [draw,circle,inner sep=0mm,minimum size=5mm]
\tikzstyle{connector} = [->,thick]
\tikzstyle{line} = [thick]
\tikzstyle{branch} = [circle,inner sep=0pt,minimum size=1mm,fill=black,draw=black]
\tikzstyle{guide} = []


\begin{document}

  \begin{tikzpicture}[scale=1, auto, >=stealth']
    \matrix[ampersand replacement=\&, row sep=0.5cm, column sep=1cm] {

      \node[guide] (u) {}; \& 
      \node[branch] (u1) {}; \& 
      \node[block] (F1) {$F_1$}; \& 
      \node[guide] (y1) {}; \\
      
	  \& \& 
	  \node[block] (F2) {$F_2$}; \& 
	  \node[guide] (y2) {}; \\
    };

    % now link the nodes
    \draw [line] (u) -- node {$u$} (u1);
    \draw [connector] (u1) -- (F1);
    \draw [connector] (F1) -- node {$y_1$} (y1);
    
    \draw [connector] (u1) |- (F2); % !!! zde problem s usepackage[czech]{babel} !!!
	\draw [connector] (F2) -- node {$y_2$} (y2);

    
  \end{tikzpicture}

\end{document}

Na označeném řádku mi pdflatex při použití balíku babel hlásí několik chyb. Přikládám i část výpisu logu.

! Use of \@next doesn't match its definition.
l.41     \draw [connector] (u1) |-
                                   (F2); % !!! <--- problem s usepackage[cze...
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

Missing character: There is no ( in font nullfont!
Missing character: There is no F in font nullfont!
Missing character: There is no 2 in font nullfont!
Missing character: There is no ) in font nullfont!
Missing character: There is no ; in font nullfont!
! Extra }, or forgotten \endgroup.
\endpgfpicture ... \pgf@x }\endgroup \hss \egroup 
                                                  \pgf@insertlayers \endgrou...
l.45   \end{tikzpicture}
                        
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing } inserted.
< inserted text> 
                }
l.45   \end{tikzpicture}
                        
I've inserted something that you may have forgotten.
(See the < inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Extra }, or forgotten \endgroup.
\endpgfpicture ...dpicture \endgroup \hss \egroup 
                                                  \pgfsys@typesetpicturebox ...
l.45   \end{tikzpicture}
                        
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing } inserted.
< inserted text> 
                }
l.45   \end{tikzpicture}
                        
I've inserted something that you may have forgotten.
(See the < inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.


! LaTeX Error: \begin{tikzpicture} on input line 23 ended by \end{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H < return>  for immediate help.
 ...                                              
                                                  
l.47 \end{document}
                   
Your command was ignored.
Type  I < command> < return>  to replace it with another command,
or  < return>  to continue without it.

prosím o jakoukoli radu, díky


Řešení dotazu:


Nástroje: Začni sledovat (1) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

9.12.2011 23:44 Moriarty
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
Odpovědět | | Sbalit | Link | Blokovat | Admin
Mezitím jsem problém vyřešil jednoduše tak, že jsem výraz "|-" nepoužil a nahradil ho dvěma hranamami s hranou na fiktivním vrcholu "guide":

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel} %nelze pouzit! (vadi mu spec znak |- )

\usepackage{amsmath} % nice math symbols
\usepackage{bm} % bold math

\usepackage{tikz}
\usetikzlibrary{arrows} % for arrow heads


% TikZ styles for drawing
\tikzstyle{block} = [draw,rectangle,thick,minimum height=1cm,minimum width=2cm]
\tikzstyle{sum} = [draw,circle,inner sep=0mm,minimum size=5mm]
\tikzstyle{connector} = [->,thick]
\tikzstyle{line} = [thick]
\tikzstyle{branch} = [circle,inner sep=0pt,minimum size=1mm,fill=black,draw=black]
\tikzstyle{guide} = [inner sep=0pt,minimum size=0mm]


\begin{document}

  \begin{tikzpicture}[scale=1, auto, >=stealth']
    \matrix[ampersand replacement=\&, row sep=0.5cm, column sep=1cm] {

      \node[guide] (u) {}; \& 
      \node[branch] (u1) {}; \& 
      \node[block] (F1) {$F_1$}; \& 
      \node[guide] (y1) {}; \\
      
	  \& 
	  \node[guide] (u2) {}; \& 
	  \node[block] (F2) {$F_2$}; \& 
	  \node[guide] (y2) {}; \\
    };

    % now link the nodes
    \draw [line] (u) -- node {$u$} (u1);
    \draw [connector] (u1) -- (F1);
    \draw [connector] (F1) -- node {$y_1$} (y1);
    
    \draw [line] (u1) -- (u2); 
    \draw [connector] (u2) -- (F2);
	\draw [connector] (F2) -- node {$y_2$} (y2);

    
  \end{tikzpicture}

\end{document}
Pokud by však někdo věděl, jak přesto tento operátor zalomené hrany (popřípadě i jiné znaky) použít i s balíkem "babel", prosím, dejte vědět.

Díky, Jakub
Řešení 1× (Ramwi)
wamba avatar 10.12.2011 03:28 wamba | skóre: 38 | blog: wamba
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
Odpovědět | | Sbalit | Link | Blokovat | Admin
po troše googlení a experimentů jsem přišel na

\begin{tikzpicture}[scale=1, auto, >=stealth']

\shorthandoff{-}

PS. na takhle jasně položeny otázky (s funkčním kódem) je radost odpovídat :)
This would have been so hard to fix when you don't know that there is in fact an easy fix.
10.12.2011 15:11 Moriarty
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
Paráda, funguje! :D

Výsledný soubor nebude tak jednoduchý jako můj příklad. Je dost náročné všude vytářet pomocné uzly ("guide"). Tohle určitě hodně ulehčí práci. Ještě jednou moc díky (i za rychlou reakci).

Jakub
10.12.2011 16:00 Ramwi | skóre: 2
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
mimochodem, tenhle tríček funguje i pro konflikt s [czech] u cline v tabulkách.
Jsem BFU a nestydím se za to.
2.4.2013 17:32 EnaXtou
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
U mě taky vyřešilo problém, děkuji moc :)
18.3.2019 21:58 Lanparties
Rozbalit Rozbalit vše Re: Latex Tikz se "nesnese" s balikem babel
Odpovědět | | Sbalit | Link | Blokovat | Admin
I po 7 letech neskutečná pomoc. Díky!

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.