创建 tikz 图片 | 箭头和标签的问题

创建 tikz 图片 | 箭头和标签的问题

我对 Ti 还很陌生Z 和我想要为我的测量类创建一个图表。我创建了以下图片:

\documentclass{standalone}
\usepackage{float}
\usepackage{amsfonts}
\usepackage{mathrsfs}
\usepackage{tikz}
\begin{document}
   \begin{tikzpicture}[scale=1.5]
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        \draw [thick,->] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,->] (A) to node[midway,above left, yshift=-13 pt] {$T \circ f$} (C);
    \end{tikzpicture}
\end{document}

问题说明

但是,我在执行代码时遇到了问题,因为组合标签出现在箭头上方,而箭头提示却没有出现。

下面的代码包含了我原来拥有的所有包,以防某些包与我的图片不兼容。

%Colores
\usepackage{xcolor}
%Evita problemas con tildes y caracteres especiales
\usepackage[utf8]{inputenc}
%Secciones con formato
\usepackage{sectsty}
%Formato del Documento
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
%Formato de entornos de enunciados matemáticos
\usepackage{amsthm}
%amsmath + más simbolos utiles
\usepackage{mathtools}
%Cosas en Español
\usepackage[spanish]{babel}
%Hipervínculos
\usepackage{hyperref}
%Letras de conjuntos notables
\usepackage{dsfont}
%Más simbolos matemáticos útiles
\usepackage{amssymb}
%Inclusión de imágenes
\usepackage{graphicx}
%Hipervínculos
\usepackage{hyperref}
%Comentarios largos
\usepackage{comment}
%Citas y Referencias
\usepackage{apacite}
%Editando las etiquetas de las numeraciones
\usepackage{enumitem}
%Caritas
\usepackage{wasysym}
%Interlineado
\usepackage{setspace}
%tablas acomodadas 
\usepackage{float}
%Rotar en Tabla 
\usepackage{multirow}
%Encabezado y pie de página
\usepackage{fancyhdr}
%cancelaciones
\usepackage{cancel}
%Letras caligraficamente perfectas
\usepackage{mathrsfs}
%Graficas poderosa
\usepackage{tikz}

另外,我想包含出现在我的原始文档中的错误:

Argument of \language@active@arg> has an extra }.
Runaway argument?
Missing \endcsname inserted.

答案1

附件中列出了您拥有的几个选项。您可能希望在 pgfmanual 中查找它们,例如通过索引、查找等。我指出了代码中的更改,包括\section和一些视觉更改comment。选项transform shapescale可能是您遗漏的选项。

结果

% https://tex.stackexchange.com/questions/684274/creating-tikz-picture-problem-with-arrows-and-labels?noredirect=1#comment1697768_684274

%\documentclass{standalone}
\documentclass[10pt]{article}
%\usepackage{float}% <<<--- not needed here
\usepackage{amsfonts}
\usepackage{mathrsfs}
\usepackage{tikz}

\begin{document}

\section{as posted}
   \begin{tikzpicture}[scale=1.5]
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        \draw [thick,->] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,->] (A) to node[midway,above left] {$T \circ f$} (C);
    \end{tikzpicture}

\section{changed scale}    
    \begin{tikzpicture}[scale=1.0]% <<<---
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        \draw [thick,->] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,->] (A) to node[midway,above left] {$T \circ f$} (C);
    \end{tikzpicture}


\section{with shorten}
   \begin{tikzpicture}[scale=1.5]
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        % <<<--- -----------|
        \draw [thick,->,shorten >=10pt] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->,shorten >=10pt] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,->,shorten >=10pt] (A) to node[midway,above left] {$T \circ f$} (C);
    \end{tikzpicture}
    

\section{with transform shape}
   \begin{tikzpicture}[scale=1.5, transform shape]% <<<---
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        \draw [thick,->] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,->] (A) to node[midway,above left] {$T \circ f$} (C);
    \end{tikzpicture}


\section{with transform shape and shifted text}
   \begin{tikzpicture}[scale=1.5, transform shape]% <<<---
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
        \draw [thick,->] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,->] (B) to node[midway,right] {$f$} (C);
        % <<<--- ------------------------------------------------|
        \draw [dashed,thick,->] (A) to node[midway,above left,yshift=-1.5em] {$T \circ f$} (C);
    \end{tikzpicture}
   
\end{document}

答案2

我发现语言包会影响>箭头中字符的使用,因此您可以尝试使用普通 tikz 提供的其他类型的定义,或者您可以使用示例中的元箭头。我建议您查看tikz 视觉手册第 21 和 56 页。

结果:

在此处输入图片描述

梅威瑟:

\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage[spanish]{babel} %<---Here this throws an error using the ">" symbol for arrows, try using arrows.meta
\usepackage{mathrsfs}
\usepackage{float}
\usepackage{amsfonts}
\usepackage{mathrsfs}
\usetikzlibrary{arrows.meta} %<--- 
\begin{document}

   \begin{tikzpicture}[]
        %Mis espacios
        \node (A) at (0,3) {$(\Omega, \mathscr{F},\mu)$};
        \node (B) at (3,3) {$(\Omega',\mathscr{F}')$};
        \node (C) at (3,0) {$(\mathbb{R}^1,\mathscr{R}^{1})$};
        %Los mapas
         \draw [thick,-Classical TikZ Rightarrow] (A) to  node[midway,above] {$T$} (B);
        \draw [thick,-To] (B) to node[midway,right] {$f$} (C);
        \draw [dashed,thick,-Triangle] (A) to node[midway,sloped,above] {$T \circ f$} (C);
    \end{tikzpicture}
\end{document}

顺便说一句,我没有发现您列出的其他软件包存在任何其他不兼容性,这些软件包当然是您的主文档所必需的,在独立的 tikz 环境中,它可以在开始时声明,而 tikz 本身会调用其他软件包,如 xcolor,当然如果它是最终图像应该在您的主文档中管理,就像它是一张普通图像一样,只是您必须以 pdf 格式导入它,这样您就可以缩放、旋转它,甚至嵌套它,您可以在很久以前的以下帖子中看到这一点:将 tikzpicture 的不同组件缩放在一起

答案3

使用tikz-cd包。

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz-cd}
\usepackage{mathrsfs}

\begin{document}
\begin{tikzcd}[row sep =1.5cm]
{(\Omega, \mathscr{F},\mu)} \arrow[rd, "T\circ f"{sloped}, dashed] \arrow[r, "T"] & {(\Omega',\mathscr{F}')} \arrow[d, "f"] \\
& {(\mathbb{R}^1,\mathscr{R}^{1})}       
\end{tikzcd}
\end{document}

在此处输入图片描述

相关内容