为什么无法在文本路径中排版越南语?

为什么无法在文本路径中排版越南语?

以下是带有圆形文本路径的奖牌设计。它与英语配合得很好。但是当排版越南语时,会报告错误。你能帮我吗?

  \documentclass[12pt, border=11pt]{standalone}
    \usepackage{amsmath,  latexsym, amscd, amsthm}
    \usepackage{pgf,tikz}
    \usetikzlibrary{shapes.geometric,calc}
    \tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
    \usepackage{tikz}         
    \usetikzlibrary{decorations,decorations.text} 
    \usepackage[utf8]{vietnam}
    \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)
    }}  
    \begin{document}

    \begin{tikzpicture}[color=black, line width=.372mm, line cap=round]
    \node[draw=black,minimum size=8.8cm,regular polygon,regular polygon sides=13] (a) {};

    % draw a black dot in each vertex
    \foreach \x in {1,2,...,9}%
      \fill (a.corner \x) circle[radius=.2pt];
    \path 
        [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\scshape\huge|\  TÌM KIẾM TÀI NĂNG TOÁN HỌC TRẺ \ },
          text align=fit to path,reverse path}, decorate}]
         circle[radius=3.508742cm] ; 

    \draw  (2.04,5.4) -- (-2.04,5.4);
    \draw  (-2.04,3.9) -- (-2.04,5.4);
    \draw  (2.04,3.9) -- (2.04,5.4);

    \draw [fill=gray,rounded corners] (-1.7,4.6) rectangle (1.7,5.05); 
    \end{tikzpicture}
    \end{document}

在此处输入图片描述

答案1

在此处输入图片描述

您需要将 UTF-8 字节放在一起,pdftex 会将多字节编码字符的每个字节视为单独的标记,通常这是可以的,因为它们都是相邻的并组合成一个字符,但如果字节被分开并沿着路径隔开,UTF8 解码就会完全中断。将每个字母分组意味着循环将每个字母视为一个单元。

  \documentclass[12pt, border=11pt]{standalone}
    \usepackage{amsmath,  latexsym, amscd, amsthm}
    \usepackage{pgf,tikz}
    \usetikzlibrary{shapes.geometric,calc}
    \tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
    \usepackage{tikz}         
    \usetikzlibrary{decorations,decorations.text} 
    \usepackage[utf8]{vietnam}
    \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)
    }}  
    \begin{document}

    \begin{tikzpicture}[color=black, line width=.372mm, line cap=round]
    \node[draw=black,minimum size=8.8cm,regular polygon,regular polygon sides=13] (a) {};

    % draw a black dot in each vertex
    \foreach \x in {1,2,...,9}%
      \fill (a.corner \x) circle[radius=.2pt];
    \path 
        [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\scshape\huge|\ { }{T}{Ì}{M}{ }{K}{I}{Ế}{M}{ }{T}{À}{I}{ }{N}{Ă}{N}{G}{ }{T}{O}{Á}{N}{ }{H}{Ọ}{C}{ }{T}{R}{Ẻ}{ }\ },
          text align=fit to path,reverse path}, decorate}]
         circle[radius=3.508742cm] ; 

    \draw  (2.04,5.4) -- (-2.04,5.4);
    \draw  (-2.04,3.9) -- (-2.04,5.4);
    \draw  (2.04,3.9) -- (2.04,5.4);

    \draw [fill=gray,rounded corners] (-1.7,4.6) rectangle (1.7,5.05); 
    \end{tikzpicture}
    \end{document}

答案2

如果你编译的xelatex话绝对没有问题:

\documentclass[12pt, border=11pt]{standalone}
 \usepackage{amsmath, latexsym, amscd, amsthm}
    \usepackage{pgf,tikz}
    \usetikzlibrary{shapes.geometric,calc}
    \tikzset{my polygon/.style={regular polygon,regular polygon sides=#1,minimum size=4cm}}
    \usepackage{tikz}
    \usetikzlibrary{decorations,decorations.text}
\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)
    }}
    \begin{document}

    \begin{tikzpicture}[color=black, line width=.372mm, line cap=round]
    \node[draw=black,minimum size=8.8cm,regular polygon,regular polygon sides=13] (a) {};

    % draw a black dot in each vertex
    \foreach \x in {1,2,...,9}%
      \fill (a.corner \x) circle[radius=.2pt];
    \path
        [rotate=190,postaction={decoration={text along path,text format delimiters={|}{|}, text={|\scshape\huge|\ TÌM KIẾM TÀI NĂNG TOÁN HỌC TRẺ \ },
          text align=fit to path,reverse path}, decorate}]
         circle[radius=3.508742cm] ;

    \draw (2.04,5.4) -- (-2.04,5.4);
    \draw (-2.04,3.9) -- (-2.04,5.4);
    \draw (2.04,3.9) -- (2.04,5.4);

    \draw [fill=gray,rounded corners] (-1.7,4.6) rectangle (1.7,5.05);
    \end{tikzpicture}

    \end{document} 

在此处输入图片描述

相关内容