Here is a MWE:  \documentclass{article} \usepackage{pgf} \usepackage{pgfplots} \usetikzlibrary{math} \begin{document} \tikzmath{   int \foo;   \foo = random(-16,10);   print {Foo value: \foo.}; }  \tikzmath{   int \foo;   \foo = random(2,10);   print {Foo value: \foo.}; } \end{document}   Please note the beginning of first line. Is this behavior normal?
76223
\documentclass{minimal} \usepackage{tikz} \begin{document} \pgfmathparse{random(-5,5)} \pgfmathresult \end{document}   Works, but I have a .0.0 that not supposed to be here.
38396
In a Tikz Figure, I'm doing some computation and want to print results as label of nodes. The problem is that I only need the integer part of the number to print.  I tried with round() function. It round the values correctly but they are printed with .0  \begin{tikzpicture}    \foreach \i in {1,2,3,4,5,6} {       \pgfmathparse{round(\i*100/3) }        \let\theIntINeed\pgfmathresult        \draw (\i,0) node {\theIntINeed};    }  \end{tikzpicture}  % Results: 33.0 67.0 100.0 133.0 167.0 200.0   Thank you in advance.
59017
I'm trying out  with gnuplot to generate the data.  This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the graph.  The problem I'm having is that I get different behaviour under xelatex as pdflatex or lualatex.  In xelatex, the data file is littered with ^^I whereas in the other two formats these are tabs.  It appears that the code ^^I is getting stored as a macro which then gets written out to the file, so possibly there's something funny going on with the ^^I syntax: xelatex is reading it literally.  Indeed, when I do \show\pgfplots@TAB (the macro in question) then for pdflatex and lualatex then I get a literal tab whereas for xelatex I get ^^I.  So how do I get a tab in xelatex?  And why isn't \gdef\pgfplots@TAB{^^I} working?  (The previous line in the code, by the way, is \catcode`\^^I=12 - I don't know if that has anything to do with it.)
68344
I'm trying to plot the function  (0.5*x+1)^(-2)   for x in [0,6].   Here's my code:  \documentclass{scrartcl} \usepackage{pgfplots} \pgfplotsset{compat=1.12}  \begin{document}    \begin{tikzpicture}  \begin{axis}[       thick,       axis lines = center,       axis line style={-&gt;},       xmin = 0, xmax = 6.1,       ymin = 0, ymax = 1.1,       restrict y to domain = 0:1,       xlabel = {$t$}, ylabel = {$\phi(t)$},       xlabel style={at=(current axis.right of origin), anchor=west},       ylabel style={at=(current axis.above origin), anchor=south},       ]       \addplot[no marks,                 thick,                samples = 200,                ] expression {(0.5*x+1)^(-2)};   \end{axis} \end{tikzpicture} \end{document}   This produces    The problem is that the plot stops after x = 5. Also for x = 0, the function value should be 1. This doesn't seem to be the case in my plot.
53196
Why does pgfplots plot functions only until x = 5 and y = 5, but not any further?    \documentclass{article}  \usepackage{tikz} \usepackage{pgfplots}  %%%&lt; \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt} %%%&gt;  \begin{document} \begin{tikzpicture} \begin{axis}[samples=100,ymin=0,ymax=10,xmin=0,xmax=20]  \addplot [thick] plot  (\x,  {1/(1 + exp(-0.6*(\x - 12)))}); \addplot plot (\x, {\x});  \end{axis} \end{tikzpicture} \end{document}
17277
I have been trying for a while to load the tikz package to the IEEE ACCESS template. Whenever I use the command \usepackage{tikz}, I am getting the error   /usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex, line 33 Missing number, treated as zero.   It was working fine with the IEEEtran template and I was able to draw my circuit diagrams in that.   Anyone has any idea how to solve this issue?
14189
I am trying to learn \foreach in TikZ and I am confused because of all the errors I get. Here is a code sample I tried that gave me:  ForeachEvaluateTest.tex:0:File ended while scanning use of \pgffor@stripcontext     \documentclass{article} \usepackage{tikz}  \begin{document}   \pgfmathsetmacro{\dx}{5}  \pgfmathsetmacro{\offx}{2}   \begin{tikzpicture}   \pgfmathsetmacro{\endi}{\offx+\dx}   \pgfmathsetmacro{\starti}{\offx}    \foreach \i [evaluate=\i] in {\starti,...+1,\endi}   {    \draw (\i,0) -- (\i,1);   }  \end{tikzpicture}     \end{document}   I manage to fix this by a strange modification which can not possibly be the best way to fix it.  \documentclass{article} \usepackage{tikz}  \begin{document}   \pgfmathsetmacro{\dx}{5}  \pgfmathsetmacro{\offx}{2}   \begin{tikzpicture}   \pgfmathsetmacro{\endi}{\offx+\dx-1}   \pgfmathsetmacro{\starti}{\offx-1}    \foreach \i [evaluate=\i] in {\starti+1,...+1,\endi+1}   {    \draw (\i,0) -- (\i,1);   }  \end{tikzpicture}     \end{document}   Any pointers to why this makes a difference?
20624
I apologize if this has already been covered in some other posts, but I couldn't find it anywhere and I'm not even sure if "brace diagram" is the correct name in English.  I have found some examples of probability trees, and some others that are close (like this: ), but while playing with them I couldn't get the correct output (The part of the first "text here" when out of boundaries into the brace).  What I'm trying to do is something like this with TikZ:    I know there are some ways to do this with mathmode, but I'm really interested in learning a little more about TikZ and how it works for diagrams like this.
119150
I do not understand the relation of a normal variable "x", which is to me just a placeholder for an element of a set, and a random variable, which is a mapping from the set of all possible events to $\mathbb{R}$.  To make the question more concrete, some parts I am struggling with:   Normal functions with variables can be evaluated, e.g. $f(x)=2x$ will plot to a line, can I do this with a function of a random variable? Furthermore the randomness part seems to be missing, why is it not neccessary to define how the random variable obtains its random value?     Edit: now that I feel I understood the definition, I cannot say what exacly what was missing for understanding. Nevertheless reading the following links, the comments and answer here, did the trick.
74537
I have found a strange behavior in TikZ. When using the \draw ... to ... syntax and trying to place nodes along the line with the node[...]{...} syntax, the nodes do not turn up at the expected location.  \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}   \draw(0,0) to[out=60,in=120] (1,0) node[midway]{x}; \end{tikzpicture} \end{document}     How is this done properly?
89929
I want to create a tutorial how to use TikZ now. Is there a listings configuration for TikZ as used in PGF/TikZ manual?  For example, I want to make \ as an integral part of tikz in \tikz, relevant macros must  have consistent colors, no annoying line numbers, PDF copy-paste friendly, etc.
30384
I want to describe the variables involved in an equation in an itemized environment such that every item begins with the variable name and subsequently comes the description for it. I'd like to have all the descriptions left aligned.  Here is a MWE that of course does not produce what I am looking for.  \documentclass{standalone} \begin{document} $E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$. % where, % \begin{itemize}     \item $x$      \quad is a continuous random variable.     \item $f_X(x)$ \quad is the PDF of $x$.     \item $g(x)$   \quad is a function of $x$. \end{itemize} \end{document}
5823
I'm trying to plot some recursively defined sequence with tikz and am encountering some behavior I can't understand, here is my code:  \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\f}{1} \foreach\i in {1,...,10} {   \pgfmathsetmacro{\ff}{\i*\f}   \draw (0,\i) node {\ff};   \pgfmathsetmacro{\f}{\ff}   } \end{tikzpicture} \end{document}   I would have expected this to print the sequence of the factorials of the first ten integers (going down) but what I get is 10,9,...,1. What is happening ? How can I handle such recursively defined functions in Tikz ?
32266
What I am thinking was I need two formulas, AX.p(X) => something AX.p(X) => ~ something   I guess something maybe is the p(x) and the other is ~p(x) since we was given EX.~p(x)..But actually it can't work for me. And I guess maybe is EX.~p(x) and ~EX.~p(x)..But if I am doing that then the it will go to deadend..so I give up..;(  Wish someone can help me.   For note about EE: 1: EX.p(X) 2: AX.(p(X) => something) 3: something EE1,2 But something cann't have the free variable from p..in this sample, then soemthing cannot including X..so if something is p(X) it cannot use EE, but if p(Y) then can use EE.
71738
Hi I am wondering what code is used to get text above the $\rightarrow$   have tried $ \xrightarrow{P}$ but not running on my LaTeX as I do not know which package to install or how to install it.   currently using \usepackage{mathtools} but it wants to load from a random directory and then LaTeX stops working.
34282
I have random variables $X_{1}, X_{2}, \dots X_{n}$ that are each Unif$\{1, \dots, n\}$, and I want to calculate $$P(\{X_{1}, X_{2}, \dots X_{n}\}=\mathbb{N})$$  My intuition is that this means each $X_{n} = n$, which occurs with probability $\frac{1}{n!}$.  Does this seem correct?
5118
I'm trying to learn to plot in latex, but I'm having a problem trying to find out which packages that are best to use in this situation, and I find it a bit of a learning curve.   Suppose you have the following function:    I would like to know, how I could graph this in Latex. I have searched around and found out that you could use the PGF and tikz packages, and use the declare function, but I have problems with the intervals in which $x$ is defined   How would I approach this problem, as a complete newbie to graphing in Latex?  I tried using a similiar post about it, and tried to plug in my intervals. My code looks like this:   \documentclass[tikz]{standalone} \usepackage{pgfplots} %\pgfplotsset{compat=1.8} \begin{document} \begin{tikzpicture}[   declare function={     func(\x)= (\x \in [-\pi, -\frac{pi}{2}) * (0)   +      and(\x \in [-\frac{\pi}{2},\frac{\pi}{2}) * (\frac{\pi}{2}-|x|)     +      and(\x \in [\frac{\pi}{2}, \pi]) * (0)    ;   } ] \begin{axis}[   axis x line=middle, axis y line=middle,   ymin=-5, ymax=5, ytick={-5,...,5}, ylabel=$y$,   xmin=-5, xmax=5, xtick={-5,...,5}, xlabel=$x$, ] \end{axis} \end{tikzpicture}  \end{document}