Hot answers tagged

17

From the Manual ! • It is only possible to typeset text in math mode under considerable restrictions. Math mode is entered and exited using any character of category code 3 (e.g., in plain TEX this is $). Math subscripts and superscripts need to be contained within braces (e.g., {^y_i}) as do commands like \times or \cdot. However, even modestly ...


9

You can exploit the path picture key of the nodes: \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \usepackage{amsmath} \begin{document} \begin{tikzpicture} \draw[fill=black!20!white] (0,2)--(2,0)--(3,0)--(3,2)--cycle; \draw (0,0) --node[below] {$2x$}(2,0)--node[below] {$\vphantom{2}x$}(3,0)--(3,2)--(0,2)-- node[left] ...


9

The easiest way is probably to replace \renewcommand{\signU}{\signS} by \let\signU\signS, etc. Then \signU is assigned the current meaning of \signS. Your method does not work because \renewcommand does not expand the definition text at the time of definition. Instead, it is expanded when the command is used.


8

Since I have no idea what the question is, this is distantly and coincidentally related at best. Still, maybe it will help somebody - possibly even the OP. \documentclass[border=10pt,tikz,multi]{standalone} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture}[thick] \draw (0,0) edge [decorate, decoration = {zigzag}] ++(5,5) ...


7

Although it is possible to use a macro as shown in Christian Hupfer's answer, this is not really the best approach when using TikZ, whichever macro format you choose for your document. Instead, it would be better to use TikZ's key-value syntax to create a sty style with \tikzset{}. Note, however, that \tikzstyle is deprecated and ought not be used in new ...


7

The key-values contained in \sty aren't expanded this way, this causes an error. You can use \draw \expandafter[\sty]... however Using a tikzstyle is better, however. \nopagenumbers \input tikz.tex \def\center#1\endcenter{\centerline{#1}} \def\sty{step=.5cm,gray,very thin,dashed} This is my first plain \TeX\ file. Let me try some commands below: \vskip ...


7

Try using \let instead of \renewcommand: \documentclass{article} % \newcommand{\signS}{$+$}% \newcommand{\signT}{$-$}% \newcommand{\signU}{}% % \begin{document} old \textbackslash signS: \signS \let\signU\signS \let\signS\signT \let\signT\signU new \textbackslash signS: \signS \end{document}


7

This is actually described in the manual for pgf/TikZ. See section 92.1 Changing display styles (for v3.0.1a, dated August 29, 2015). You're almost there in fact, just change the number formatting option for the yticklabels to /pgf/number format/.cd,sci,sci e. If you want a capital e, use sci E instead. \documentclass[border=4mm]{standalone} ...


7

Here's a version of your Cayley diagram done with Metapost and luamplib. You need to compile the source below with lualatex in order to use the built in Metapost engine. If you are using a different LaTeX engine, you can easily adapt this solution to work with plain Metapost. Follow the links above for details. Whether this is "easy-to-use" of course ...


7

Spaces. If you look carefully at the error message you see it refers to the symbolic coordinate called ' sphinx3', i.e. with a space first. In the list of symbolic y coords leading spaces are stripped, but this does not happen in the coordinate list for \addplot. So all you have to do is to change from (132, sphinx3) to (132,sphinx3). You might also want to ...


6

Probably not perfect, but a step in the right direction: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.markings,arrows.meta} \begin{document} \begin{tikzpicture}[mid arrow/.style={postaction={ decoration={markings, mark=at position 0.5 with {\arrow{Triangle}}}, decorate}},looseness=0.5] \foreach \i [count=\j, count=\r from 0] in ...


6

Yo! Ignasi's comment was eye-opening: "The path" is in fact many paths, each of them starting from top to its respective child. Seems obvious if you think about it. Each of them nicely a la chef, but each of them also ruining the one drawn before. Cool, so here's my next take on the problem, throwing \pgfonlayer into the mix, as borrowed from this post on ...


6

The arc is a full semi circle since you are drawing from 0deg to 180deg (0:180:2 i.e., 0deg to 180deg with radius 2). To make it a quarter circle, draw it from 0 deg to 90 degree (0:90:2 i.e., 0deg to 90deg with radius 2). \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \begin{document} ...


6

First version with Xy-pic \documentclass{article} \usepackage[all]{xy} \begin{document} \[ \xymatrix{ & P \ar@{.>}[dl]_{h} \ar[d]^{f} \\ A \ar@{->>}[r]^g & B \ar[r] & 0 } \] \end{document} Improved version with Xy-pic \documentclass{article} \usepackage[all,cmtip]{xy} \begin{document} \[ \xymatrix{ & P ...


6

The macro hides the syntax characters. The comma as separator for the key value pairs and the equals sign need to be visible by the key value parser. But it is possible to define styles via \tikzstyle (seems to be deprecated, the documentation uses it, but does not explain it) or via the .style handler, e.g.: \nopagenumbers \input tikz.tex ...


6

You should define macros for the pictures; here's a possibility. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{mathtools} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{shapes,snakes} \newcommand{\KP}[1]{% \begin{tikzpicture}[baseline=-\dimexpr\fontdimen22\textfont2\relax] #1 \end{tikzpicture}% } \newcommand{\KPA}{% ...


5

Late to the question here, but this should be workable. I'm not certain if I have the right semantics for the different fields, but this should be relatively easy to adapt: \documentclass{standalone} \usepackage{tikz} \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \newcommand{\bitrect}[2]{ ...


5

Here is a starting point for you, using the decorations.markings library of tikz as suggested by percusse. You just need to adjust the path in the way you want, to draw the 'star' correctly and the decoration of the path is done by tikz. By the way, is there any good reason, why you've started to define your coordinates in 3 dimensions? At least for getting ...


4

Just start at one end and work your way through \documentclass[a4paper]{memoir} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} % I tend to like placing nodes manually \begin{scope}[minimum width=15mm,minimum height=10mm] \node[draw] (v1) at (0,0) {$v_1$}; \node[draw] (v2) at ($(v1)+(6,0)$) {$v_2$}; \node[draw] ...


4

One box and a path picture: \documentclass[tikz,border=5]{standalone} \tikzset{bicolor/.style args={#1 and #2}{ path picture={ \tikzset{rounded corners=0} \fill [#1] (path picture bounding box.west) rectangle (path picture bounding box.north east); \fill [#2] (path picture bounding box.west) rectangle (path picture bounding ...


4

I would not use \chainin at all and would instead use \draw: \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix,arrows} \begin{document} \begin{center} \begin{tikzpicture}[>=stealth,->,shorten >=2pt,looseness=.5,auto] \matrix (M)[matrix of math nodes,row sep=10mm,column sep=16mm]{ 0 & A & B & C & 0 \\ ...


4

See, if the following MWE gives what you expected: Figure is slightly changed in comparison to your sketch. If you not liked this, just change sibling distance accordingly and text write in one column. \documentclass[tikz, border=3mm, ]{standalone} \usetikzlibrary{fit}% <-- new \begin{document} \begin{tikzpicture}[ ...


4

You need overlay to ignore the extra width, but you also need \hspace to reserve the space and center the overlay. \documentclass[]{beamer} \usepackage{tikz} \usetikzlibrary{shapes,calc} \newsavebox\smmbox \newif\ifsmm \newcommand*{\mysmc}[1]{% \relax\ifmmode\smmtrue\else\smmfalse\fi% \savebox{\smmbox}{\ifsmm$#1$\else#1\fi}% \hspace{0.5\wd\smmbox}% half ...


4

For the first question, you can gradually change the distances as you alter the opacity using the same basic idea. At least, I think so. I don't entirely understand why things are lower to the right of the equation i.e. why 4ac is lower than 4abx and that is lower than 4aax^2, so perhaps I've not properly understood how this is meant to work. ...


4

As mentioned in the comments you can create a path from the arcs you already defined for filling. I just slightly redefined your arca : \documentclass[11pt, a4paper]{article} \usepackage{textgreek} \usepackage{amsmath} \usepackage{graphicx} \usepackage{tikz} \begin{document} \begin{figure} \centering \begin{tikzpicture} %Outer lining of the tube. \draw ...


4

Some points: align cannot see a & that is inside a TikZ node. Put E_s &= outside the \tikz-picture. \subnode should be used as \subnode{d4}{$X$}, not \subnode(d4){$X$} (note braces). And you need to set the baseline of the the tikzpicture to something useful. \documentclass{article} \usepackage{amsmath, amsfonts, amssymb, amsthm, bm} ...


4

Looks like there's a problem with the way midmark takes in its argument. If you use curly braces to contain the node options, then everything works fine: midmark={[{above,xshift=1em}]{text}}


4

Here's my version with Tikz. There are some minor details that I simplified but I'd say it resembles your image enough. The only thing missing are the circles to symbolize the gas, but I don't think that'd be hard for you to replicate. The command is as follows: \flask[ <arrow direction> ]{ <position of the flask> }{ <pressure> }{ ...


4

You know how to use coordinates. So you could just say \draw[thick] (C1.east) -- ++(1,1) coordinate (y) -- (y |- C2.south);. I left the red line in the code as thin and dashed for comparison. \documentclass[border=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[font=\sffamily] \node[draw, circle](C1) at ...


3

Something like this? \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture}[every node/.style={anchor=base west}] \matrix [matrix of math nodes, row sep=5mm] { \node (X) {X_{i}}; \\ \node (Y) {Y_{ij}}; \\ \node (Z) {Z_{ijk}}; \\ }; \draw (X) -- (Y.north -| X); % <--- added -| X for determining ...



Only top voted, non community-wiki answers of a minimum length are eligible