1

I am pretty new on TikZ and I want to create a diagram for my measure class. I created the following picture:

\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}

Problem illustration

However I am having problems with the executions of the code since the label of compositions appears over the arrow and the arrow tips do not appear.

The following code includes all the packages I have originally in case some package is not compatible with my picture.

%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}

Also, I would like to include the error that appears on my original document:

Argument of \language@active@arg> has an extra }.
Runaway argument?
Missing \endcsname inserted.
6
  • Welcome. // Probably related to the scale. See the Petri net tutorial in the manual. Close to the end it shows how to retract the ends a little. // try als yshift=-12 pt or so to lower the diagonal text, apply inside [ ... ]. // BTW, your code can‘t compile once we copied it …
    – MS-SPO
    Commented Apr 29, 2023 at 16:25
  • Thanks! I updated my code. I notice the in this ocassion the arrows tips appear. However in my original document they dont. About scale, what's your suggestion?
    – Topology G
    Commented Apr 29, 2023 at 16:36
  • 1
    Welcome to TeX.SE!! Your code works fine in my machine. However, you probably need the babel TikZ library in your complete document. Add in your preamble \usetikzlibrary{babel} to fix some issues that appear when using TikZ and babel at the same time. Commented Apr 29, 2023 at 17:16
  • 1
    Hi @JuanCastaño Your suggestion worked! Thank you :)
    – Topology G
    Commented Apr 30, 2023 at 3:08
  • 1
    Hi @MS-SPO I included to packages since sometimes they create contradiction on the code. For instance, as you may see, there was a problem with babel package and we need to fix it including the library.
    – Topology G
    Commented Apr 30, 2023 at 3:10

3 Answers 3

1

Please find attached a few choices you have. You may want to look them up in the pgfmanual, e.g. via index, find etc. I indicated changes in the code, both by \section and some visual comment. Option transform shape together with scale was probably the one you were missing.

Results

% 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}
3
  • 1
    Thanks for your time, I really apprecciate. The problem was babel jajajja
    – Topology G
    Commented Apr 30, 2023 at 3:10
  • Fine, no problem. However, that's why code posted should show the problem after compile ;-)
    – MS-SPO
    Commented Apr 30, 2023 at 8:06
  • 1
    That totally true! I see now the intention of other comment on the question. Thanlks for help :)
    – Topology G
    Commented Apr 30, 2023 at 18:00
1

I found that the language pack interferes with the use of the > character in the arrows so you can try using another type of definition as offered by normal tikz or you can use the meta arrows that is in the example case. I recommend you see the tikz visual manual pages 21 and 56.

RESULT:

enter image description here

MWE:

\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}

By the way, I did not find any other incompatibility with the other packages that you list, which of course are required for your main document, in the standalone tikz environment it could be declared at the beginning and tikz itself invokes others like xcolor, certainly if it is a The final image should be managed in your main document as if it were a normal image, only that you must import it in pdf format, so you can scale it, rotate it, even nest it, you can see that in the following post from a long time ago: Scaling different components of tikzpicture together

1
  • Hey! I looked up the manual. It opens up my mind. I see we have many options for arrow tips. Thanks for your help it is really appreciated.
    – Topology G
    Commented May 1, 2023 at 18:54
0

Using tikz-cd package.

\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}

enter image description here

1
  • 1
    It looks that the perfect tool for diagrams. It's shorter to create the diagram. I think will be usefull for future diagrams.
    – Topology G
    Commented Apr 30, 2023 at 18:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .