Tag Info

New answers tagged

1

I think this is a renderer-side problem. For the code at the end, the left one is the screenshot and the right one is the exported PNG. Here are some code/comment from pgfcorepatterns.code.tex; % Creates a new colored pattern % % [#1] = optional list of variables. % #2 = pattern name % #3 = lower left of bounding box % #4 = upper right of bounding ...


2

Have a look at cirkuit. This kde editor for tikZ circuit macros provides live preview, snippets and more.


5

With the calc tikz-library, the syntax ($A!1cm!B$) means a point 1cm from A in the direction B. Using this we can easily modify your tangent vector expressions to \foreach \p in {0,10,...,100} { \draw[-latex,color=black] (N \p.south west) -- ($(N \p.south west)!1cm!(N \p.south east)$); } \foreach \p in {0,10,...,100} { ...


1

It's probably a rounding error. If I use at position 0.999 the arrowhead shows. However, using this for straight arrows may be less than optimal, so I define also a myarrowstraight style for comparison. \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \usetikzlibrary{decorations.markings} \tikzset{ myarrow/.style={ ...


1

I cannot figure out what are you going to do. But for your subquestions: calculate the height of a node in a tikz pictures Similar to \widthof within tikzpicture \makeatletter \newcommand\getheightofnode[2]{% \pgfextracty{#1}{\pgfpointanchor{#2}{north}}% \pgfextracty{\pgf@ya}{\pgfpointanchor{#2}{south}}% \addtolength{#1}{-\pgf@ya}} ...


2

Simply add the default option to the simplestyle: \global\mdfdefinestyle{simplestyle}{% default, linecolor=red,linewidth=3pt,% leftmargin=1cm,rightmargin=1cm } This resets the styles to their default setting at the start.


0

For a Tikz based solution, you can use the baseline option to align the pictures to their north anchor in a somewhat automatic way. I've marked the new code with "new code": \documentclass[12pt]{article} \usepackage[utf8]{inputenc} % UFT8 - danske bogstaver og andet godt fra havet \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{tabularx} ...


0

Rather than trying to auto-center the tikz images, it is simpler to just apply a \raisebox to each tikz. \documentclass[12pt]{article} \usepackage[utf8]{inputenc} % UFT8 - danske bogstaver og andet godt fra havet \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{tabularx} \usepackage{booktabs} \usepackage{amsmath} % noget matematik \usepackage{amssymb} ...


3

A solution with the floatrow package. I adjusted the margins, with the geometry package, but you may as well adjust table or figure. In addition, I loaded siunitx to have a proper alignment of numbers in their columns and makecell to have a better vertical spacing between rows and use thicker horizontal rule at the bottom of the table (booktabs doesn't work ...


3

Might this be what you seek? You needed a \noindent, and the figure needed a little shrinking to fit in the margins. Also, I used stacks to both align the captions and dial in the vertical offset of the table to achieve a centered look. \documentclass[12pt,oneside,ngerman,reqno,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath,amsthm} ...


7

You can name and anchor axes to place them relative to each other \documentclass[tikz]{standalone} \usepackage{mathspec} \setmainfont{Arial} \setmathrm{Arial} %To get the units in Arial \setmathsfont(Latin,Greek,Digits){Arial} \usepackage{pgfplots} %for drawing of graphs \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} ...


12

We are still within the 12 days of Christmas and the wise men have not yet arrived bearing gifts, so I trust that I do not arrive too late. I wondered... If we have trees, why not a forest? There is, of course, no reason whatsoever to draw a Christmas tree using forest.... Nadolig Llawen! \PassOptionsToPackage{rgb,x11names,svgnames}{xcolor} ...


6

Another way, using a single \foreach and a user-defined cycle list. This cycle list can then be used throughout your document if desired. \documentclass{article} \usepackage{pgfplots} \pgfplotscreateplotcyclelist{mylist}{{color=cyan},{color=red,dashed}} % can now be used throughout the document \begin{document} \begin{tikzpicture} \begin{axis}[ ...


3

Or with just one \foreach: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[grid=major, xmin=-5, xmax=5, ymin=-30, ymax=30, xlabel=$t$, ylabel=$y$] \foreach \Valor [count=\Cont] in {-2.4,-2.1,...,2.4} { \ifodd\Cont\relax \def\Color{cyan} \def\Shape{} \else \def\Color{red} \def\Shape{dashed} ...


9

Replace all the \addplot by \foreach \a in {-2.4,-1.8,...,2.4}{ \addplot [domain=-5:5, samples=100, color=cyan]{\a*x^2}; } \foreach \a in {-2.1,-1.5,...,2.4}{ \addplot [domain=-5:5, samples=100, color=red,dashed]{\a*x^2}; } Code \begin{tikzpicture} \begin{axis}[grid=major, xmin=-5, xmax=5, ymin=-30, ymax=30, xlabel=$t$, ylabel=$y$]; \foreach \a in ...


0

You can use veclen function. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw (30:1) coordinate(a) -- (75:3) coordinate(b); \path let \p1=(a), \p2=(b), \n1={veclen(\x2-\x1,\y2-\y1)} in node{\n1}; \end{tikzpicture} \end{document} And if you want the length in cm or ...


7

With TikZ 3.0 arrives math library. This library defines a simple mathematical language to define simple functions and perform sequences of basic mathematical operations. Here is a code from the manual (p.629), slightly modified to include function use. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \usetikzlibrary{math} \tikzmath{ ...


2

Based on the OP's code, the first node can be used as the global reference point. Here the label (A) located 1 cm (which is defined by \smacro) to the right of the first node is used for the global reference for the group of nodes. Once this is set, one can use above, below, right, left= xx cm of A and its variants to locate the remaining nodes. However, ...


1

You could mix mdframed boxes with other boxes for nesting to circumvent the problem. Here, I use a tcolorbox for the nested box. \documentclass{article} \usepackage{tikz} \usepackage[framemethod=tikz]{mdframed} \usepackage[skins,breakable]{tcolorbox} %%%%%%%%%%%%%%%%% mdframed style with node \tikzset{tetregris/.style = {draw=gray, thick, fill=white, ...


1

SOLUTION 2: Here is another solution using local bounding box. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \newcommand{\graphcircuit}[2]{ \begin{scope}[local bounding box=#2] \foreach[count=\n] \v in {#1}; % count the number of elements \pgfmathsetmacro{\r}{\n*0.2} % set the node distance from (0,0) \pgfmathsetmacro{\b}{90/\n} % ...


2

I found the cause of the error. The error I was getting Paragraph ended before \pgffor@dots@stripcontext was complete. was due to having a space between the comma and the 3 dots. Now this works (I removed the overlay option as not needed) \documentclass[11pt]{report} \usepackage{amsmath,mathtools} \usepackage{graphicx} \usepackage{pdfpages} ...


1

You can use the backgrounds library to fill the node behind the group after drawing it: \documentclass[tikz]{standalone} \usetikzlibrary{fit,backgrounds} \newcommand{\graphcircuit}[1]{ \begin{scope} \def\myfitarray{} \foreach[count=\n] \v in {#1}; % count the number of elements \pgfmathsetmacro{\r}{\n*0.2} % set the node distance from (0,0) ...


3

You can fit the whole graph into a node and refer to it. And you don't need the math library for this. \documentclass[tikz]{standalone} \usetikzlibrary{fit} \newcommand{\graphcircuit}[1]{ \begin{scope} \def\myfitarray{} \foreach[count=\n] \v in {#1}; % count the number of elements \pgfmathsetmacro{\r}{\n*0.2} % set the node distance from (0,0) ...


1

This is a solution using decoration with shifted \arrow. \documentclass[varwidth,border=7]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usetikzlibrary{decorations.markings} \tikzset{ myline/.style={double distance=0.8pt, line width=0.4pt, -{>[length=2.5pt,width=4pt]}}, myline2/.style={ double distance=0.8pt, line width=0.4pt, ...


1

The task is in the form: there is given input (the set of \contentslines) and we need to create macros for reading this input and for creating desired output. I show typical plain TeX solution. You can see that the code is compact and simple. Only, what you need, is to know the \hbox / \vbox arithmetic at TeX primitive level. No external packages are needed ...


4

I would suggest using the background package and a little trickery. The following defines a new command \installbackgrounds[]{}. The first argument is optional and sets the total number of pages in the file of backgrounds. The second, mandatory argument specifies the file. If no total is specified, the number defaults to 1. \documentclass[a4paper]{report} ...


2

The fillbetween library needs the split option if it should apply different styles for different segments. In addition, the second path (B in your example) should have the same width as the first path. In your example, B spans only from x=0 to x=1 although the input data spans from 0 to 140. Here is an example with fillbetween: \documentclass{standalone} ...


3

Based on the information that MikTeX actually failed to update PGF to 3.0.0, I am able to confirm that this is a duplicate of Problem using atan in pgfplots and Miktex 2.9 pgfplots, circuitikz library collision problem . I will update Problem using atan in pgfplots to provide workarounds. There are actually two distinct problems: I introduced an ...


1

You used \centering within the minipage. Instead, use \centering at the outer level, or \begin{center} ... \end{center} at outer level, i.e. not within the mini page. Another approach would be centering using the current page node in TikZ for reference.


2

Use the scale-Option, such as \begin{tikzpicture}[scale=0.5] ... \end{tikzpicture} or the short syntax, which is convenient for small images within text: \tikz[scale=0.5] To apply that scaling also to contained shapes, you may want to add the corresponding option: \begin{tikzpicture}[scale=0.5, transform shape] ... \end{tikzpicture} As cfr already ...


3

The dateplot library shipped with pgfplots cannot handle seconds due to limited accuracy. If you need accuracy of this granularity, you can probably ignore the DATE part of your input. In this case, a solution could be as follows: \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} \def\checkSameDate#1{% \ifnum\coordindex=0 ...


1

The following uses TikZ image fill extensions from the tcolorbox package: \documentclass{article} \usepackage[skins]{tcolorbox} \begin{document} \noindent\begin{tikzpicture} \path[fill overzoom image=example-image-a] (0,0) rectangle (\textwidth,4cm); \end{tikzpicture} \medskip \noindent\begin{tikzpicture} \path[fill stretch image=example-image-b] (0,0) ...


7

An alternative would be to use the tikzmark library: \documentclass{article} \usepackage{fontspec,kantlipsum,tikz} \usetikzlibrary{tikzmark,calc,decorations.pathreplacing} \begin{document} \kant[1] \vspace*{10ex} \begin{equation} \sum_{i,\,j,\,m,\,k} \!\!\!\! \left \langle \tikzmark{Ci} C_i \tikzmark{Cj} C_j \tikzmark{Cm} C_m \tikzmark{Ck} C_k ...


3

Possibly something like this? This was produced using the pin facility for labelling nodes. Note that I've updated your code to use \tikzset consistently since \tikzstyle is deprecated. \documentclass[tikz, border=10pt]{standalone} \begin{document} \tikzset{% point/.style = {fill=black,inner sep=1pt, circle, minimum ...


6

I don't know what it should look like (I'm colorblind so everything looks OK to me) but here is the second one. Ifyour viewer can handle it play with the blend mode parameter for different effects. \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[mys/.style={pink!80,fill opacity=0.5,draw=black }] \begin{scope}[transparency group] ...


8

You don't have to place the pspicture environment to use pstricks. Instead you should use node-connections and specify the connection type after the equation: \documentclass{article} \usepackage{mathtools,lipsum} \usepackage{pstricks,pstricks-add} \psset{linewidth=.4pt} \begin{document} \lipsum[1] \vspace{2\baselineskip} \begin{equation} ...


2

There may be a way in mdframed, but I don't know it. However, what I did here was create the inner box outside of the outer environment, saved it, and stuck it in when needed. EDITED to show how multiple [named] inner boxes may be saved in advance of the outer box invocation (my initial answer used one temporary box). \documentclass{article} ...


0

Many thanks Stefan. I have now a nice tikz code for my contour: \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture} \draw[thick, ->,color=gray] (-2,0) -- (4,0) coordinate (xaxis); \draw[thick, ->,color=gray] (0,-3) -- (0,4) coordinate (yaxis); \node[below] at (xaxis) {$\mathrm{Re}(s)$}; ...


4

Here is an example using path picture. You can fill with imported image or with tikz image. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \usepackage{mwe} \tikzset{ path image/.style={ path picture={ \node at (path picture bounding box.center) { \includegraphics[height=3cm]{example-image}};}}, path tikzimage/.style={ ...


2

I also don't see why TikZ is not an option, but if you insist on that: How about using a minipage within a pgfnodebox? E.g.: \documentclass{article} \usepackage{pgf} \begin{document} \begin{pgfpicture}{0cm}{0cm}{3cm}{3cm} % (0cm,0cm) is the lower left corner, % (3cm,3cm) is the upper right corner. ...


2

There's no need for fillbetween library. You can plot twice your data but clipping the result above or below the y axis. \documentclass[paper=a4,fontsize=12pt,open=any,numbers=noenddot]{scrreprt} \usepackage{filecontents} \usepackage{pgfplots} \pgfplotsset{compat=1.10} %\usepgfplotslibrary{fillbetween} \begin{document} \begin{filecontents}{test.txt} 0 0 ...


0

This isn't a complete solution, since the spacing is slightly off, and the answer width is too large. No time to make the final adjustments. Others can edit this answer or use it as a starting point: \documentclass[11pt,a4paper,addpoints]{exam} \unframedsolutions \printanswers % or commented out for lines \usepackage{tikz} \usepackage{graphicx} ...


2

If I understand well your question, here is a macro that draws your circular graph based on your set of node values. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \newcommand{\graphcircuit}[1]{ \foreach[count=\n] \v in {#1}; % count the number of elements \pgfmathsetmacro{\r}{\n*0.2} % set the node distance from (0,0) ...


5

Drawing a colored box is my catchword for offering a tcolorbox as solution. The exact white space dimension can be set with before skip and after skip. Since you want it to be the same, you can also use beforeafter skip. I use two boxes below: The first one is the normal one, the second one just to show the distance settings. ...


4

\documentclass{article} \usepackage{tikz} \usepackage{mwe} \begin{document} \begin{tikzpicture} \node {\includegraphics[]{example-image}}; \end{tikzpicture} \begin{tikzpicture} \begin{scope} \clip (2,0) rectangle (5cm,8cm); \node[anchor=south west] {\includegraphics[]{example-image}}; \end{scope} \end{tikzpicture} \end{document} ...


4

Just for fun without PSTricks. \documentclass[tikz,12pt,dvipsnames,border=0cm]{standalone} \usetikzlibrary{patterns} \def\M{10}% columns \def\N{10}% rows \def\scale{1}% scale \def\filename{example-image-a}% filename \def\mygrid{% \draw[help lines,red,step=.1,ForestGreen!50](-\M,-\N) grid (\M,\N); \draw[help lines,red,step=1](-\M,-\N) grid ...


1

If TiKZ instead of pgf is a valid option, something like \documentclass{beamer} \usepackage{tikz} \title{This is a long title for my presentation} \begin{document} \begin{frame} \tikz \node[draw, fill=red!30, text width=5cm, align=left] at (0.05\paperwidth,-.3\paperheight) {\inserttitle}; \end{frame} \end{document} produces


2

I don't know the exam class, but it seems that inside questions environment, all paragraphs are treted differently. You can add newline without adding paragraphe break. \documentclass[11pt,a4paper,addpoints]{exam} \unframedsolutions %\printanswers \usepackage{tikz} \usepackage{graphicx} \usepackage{geometry} \usepackage{calc} ...


4

If I were you, I would do the following: In order to make your common settings accessible for all figures, diagrams, documents, etc, put the settings into a single package, namely, mycommon.sty. Register this package globally so you can use it throughout your projects. If you don't know how to do this, see my answer here (click). If you want your diagram ...


0

I have used minipage and tikz for increasing the rule automatically to end of the table of contents. Please find the answer below: \documentclass{book} \usepackage{xcolor,xparse,tocloft,fancyhdr,tikz} \usetikzlibrary{calc} \usepackage[colorlinks=false]{hyperref} \definecolor{runfootcolor}{cmyk}{0.87,0.44,0,0} \definecolor{subsectextcolor}{cmyk}{0,1,0.29,0} ...



Top 50 recent answers are included