Tag Info

Hot answers tagged

22

The closest solution I found is the experimental package poker developed by Olaf Encke. This package is based on PSTricks (with all complications to run in pdflatex) further that this package is not standard and generally is not included in the Standard TeX Distributions (MaCTeX, TeXLive or MiKTeX) and it must be manually installed. I recommend these steps: ...


16

Depends what you want to do with them. If you going to enter them in a paper to describe probabilities etc, better to use a font. As of Unicode 7.0 there are codepoints for card suite. Use the Symbola free font of George Douros. \documentclass{article} \usepackage{fontspec} \newfontfamily\symbola{Symbola.ttf} \begin{document} \Huge \symbola \char"1F0AB ...


12

You need to expand and let LaTeX know that you mean a control sequence \documentclass{article} \usepackage{amssymb} \usepackage{pgffor} \foreach \x in {C,N,Q,Z,D,R,T}{\expandafter\xdef\csname\x\x\endcsname{\noexpand\mathbb{\x}}} \begin{document} \foreach \x in {C,N,Q,Z,D,R,T}{$\csname\x\x\endcsname$} \end{document}


11

Concision at the expense of clarity and/or generalisability (if that is actually a word): \documentclass[tikz,border=5]{standalone} \begin{document} \begin{tikzpicture}[>=stealth,every node/.style={text depth=0cm}, every label/.style={label distance=0.75cm, text=red, inner sep=1cm/16}] \foreach \i [count=\j, count=\k from 0] in {5,7,9,11}{ \node ...


10

You're better served with expl3: \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\makeabbrev}{mmm} { \yoruk_makeabbrev:nnn { #1 } { #2 } { #3 } } \cs_new_protected:Npn \yoruk_makeabbrev:nnn #1 #2 #3 { \clist_map_inline:nn { #3 } { \cs_new_protected:cpn { #2 } { #1 { ##1 } } } } ...


10

For plots you are better of using pgfplots: Code: \documentclass{scrbook} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, xmax=6.9, xmin=-5.5, ymin=-0.05, ymax=0.35, xlabel={$x$}, ylabel={$y$}, ] \addplot [domain=-4:5, samples=100, ultra thick, blue] ...


9

I would go with a matrix. \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \tikzset{ table/.style={ matrix of nodes, row sep=-\pgflinewidth, column sep=-\pgflinewidth, nodes={rectangle,text width=4.5em,align=center,inner sep=0pt}, text depth=1.25ex, text height=2.5ex, nodes in empty cells }, } \begin{document} ...


9

A possible implementation with the new Blend Modes feature from TikZ v. 3.0.0 (see What are the new features in TikZ/pgf 3.0?). This allows to avoid using some clip operation: \documentclass[tikz,border=10pt]{standalone} \begin{document} \def\firstcircle{(0,0) circle (3.0cm)} \def\secondcircle{(360:3.5cm) circle (3.0cm)} \begin{tikzpicture}[blend ...


8

Try the Hobby Tikz library. It allows you to specify the incoming and outgoing angles, and produces a smoother curve. \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usepackage{tkz-euclide} \usetikzlibrary{hobby} \usepackage{graphicx} \begin{document} \begin{center} \begin{tikzpicture} ...


8

This function can be declared and evaluated directly in PGFPlots, without the need for lua. You can declare the function for the binomial coefficient using declare function={binomcoeff(\n,\k)=\n!/(\k!*(\n-\k)!);} and then use that in the declaration of the hypergeometric distribution probability mass function: declare function={ ...


7

You can use minipages: \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[margin=2cm,top=3cm]{geometry} \usepackage[nottoc,notlof,notlot]{tocbibind} \usepackage[titles,subfigure]{tocloft} \usepackage{showframe,amssymb,amsmath,fancyhdr,graphicx,booktabs,array,paralist,verbatim,subfig,sectsty,mathtools,hyperref,tikz} ...


7

Here is a solution using SVG-Cards, inkscape and PDFLaTEX/graphicx/TikZ. I provide a Makefile : to download and to extract the SVG-Cards archive (via wget and tar), to extract each SVG card from svg-cards.svg (via inkscape) to convert each SVG card into a PDF card (via inkscape) to compile cards.tex (via pdflatex) Steps: Copy the Makefile (note: the ...


7

The current stable version of pgfplots is version 1.11 (released August 2014). It supports this if you write \pgfplotsset{compat=1.11} into your preamble. Without this statement, it will remain compatible with the old behavior. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[ ...


6

As cfr points out the chains library can be used for this: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{chains} \begin{document} \begin{tikzpicture} \begin{scope}[start chain=going right, every join/.style={->}, every node/.style={draw, align=center, on chain, join, minimum height=1cm}] \node {Circuit is \\ designed in SPICE GUI}; \node ...


6

I'd draw the bold single bonds with the line-width command -[,,,,line width=2pt]. A bold double bond can be achieved by drawing a bold single bond backwards (angle = 180°) over the double bond: -[::180,,,,line width=2pt]. Here is an example: \documentclass[a4paper]{scrreprt} \usepackage[utf8]{inputenc} \usepackage{chemfig} ...


5

Put the content of minipage inside a node. You can get rid of minipage and use node itself. \documentclass{article} \usepackage{lipsum}% \usepackage{fullpage}% %% use geometry instead \usepackage{tikz}% \usepackage{graphicx}% \begin{document} \begin{tikzpicture} \node[inner sep=0pt,outer sep=0pt,text width=0.5\textwidth](a){% ...


5

When trying to center something on your page, what TeX essentially does is balancing out spacing on both sides of the object across the horizontal typeset width. When the element you're trying to center is larger than this width, it will align to the left and overflow the margin on the right. In the picture below, I've already added the showframe package ...


5

You can make the graph symmetric by ensuring that the angles at which the curve leaves B and enters E match those at L. One way to do this is to plot the curve before B and after E but clip what is drawn so that only that between B and E is displayed. \documentclass[tikz,10pt,border=5pt]{standalone} \usepackage[utf8]{inputenc} \usepackage{tkz-euclide} ...


5

I'd suggest you use qedhere after \end{tikzpicture}: Alternatively, if you want it aligned with the last line you can place the node with \node [anchor=east,overlay,inner sep=0, outer sep=0] at (m-2-2 -| 0.5\textwidth,0) {\qedhere}; Code: \qedhere after tikzpicture: \documentclass[12pt,a4paper]{report} \usepackage{tikz} ...


5

I'd just use a "helper" macro so the \savedstyle can be expanded (once): \documentclass[varwidth,border=5]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \newcommand{\misdirection}[2][]{% \begin{tikzpicture} \node (tree) at (0,0) {tree}; \node (apple) at (3,0) {#2}; \draw [blue,#1] (tree) -- (apple); ...


4

This seems to do the trick (requires the calc tikz library): \path let \p1 = (4,0) in node at (-8,1.6) {\parbox{\x1}{\color{red} In PSTricks we trust. Why?}}; It measures "4×(x unit)" by using the let operation binding \p1 to the point (4,0) (note the absence of dimension units). Then we extract its x-component by doing \x1 which expands to the correct ...


4

You can also do this sort of diagram in plain Metapost, using the built in colour-arithmetic. Colours can be thought of as (r,g,b) 3-tuples, but you can add, subtract, and scale them as vectors. Plain MP defines red as (1,0,0) green as (0,1,0) blue as (0,0,1) and white as (1,1,1). Values >1 are treated as 1 for the purposes of making colours. ...


4

With expl3, just for fun :) \documentclass{article} \usepackage{xparse} % automatically loads expl3 \usepackage{tikz} \usetikzlibrary{arrows.meta} \newcommand{\misdirection}[2][]{% \begin{tikzpicture} \node (tree) at (0,0) {tree}; \node (apple) at (3,0) {#2}; \draw[blue,#1] (tree) -- (apple); \end{tikzpicture}} \ExplSyntaxOn % Declare our ...


4

You can use \ifnum to test to see if \n is 1 or -1 and adjust the label: \ifnum\n=1 \textcolor{red}{$i$} \else \ifnum\n=-1 \textcolor{red}{$-i$} \else $\n i$ \fi \fi Notes: Added red color to make the changes more obvious. It is better to use pgfplots for graphing instead of just tikz. Code: ...


4

I read this answer on the site and tried to draw what you are questioning. %pgfplots \documentclass[margin=0.5mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) circle (0.5); \draw (90:1) -- (-30:1)--(210:1)--cycle; \draw (90:1)--(0,0); \draw (210:1)--(0,0); \draw (-30:1)--(0,0); \draw (30:0.5)--(0,0); ...


4

You could try a decoration which provides \pgfdecoratedangle (for straight lines this gives angle of the line) and use this to apply the appropriate arrow: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.pathreplacing,arrows.meta} \tikzset{barbs/.style={ decoration={show path construction, lineto code={ \draw ...


4

Do you mean something like this? This offsets the radial vectors by the amount specified in \offset: Notes: As per @Bordaigorl's suggestion I have drawn the circle after the radial vectors which yields better line quality as then the circle is on top of the radial vectors. Code: \documentclass{article} \usepackage{tikz} \tikzset{radial ...


4

Labels are also nodes. So TiKZ is setting each label in a circle. Since larger labels need larger circles, those labels are set further away from the labelled node. You can avoid this by explicitly specifying the usual rectangular shape for labels: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} [ every node/.append ...


3

This can (if desired) be done within a single \graph command: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{graphs} \usetikzlibrary{graphs.standard} \begin{document} \begin{tikzpicture}[every node/.style={draw,circle,very thick}] \graph [clockwise] { subgraph C_n [n=5,name=A, radius=2cm]; subgraph I_n [n=5,name=B, radius=1cm]; ...


3

I don't think TikZ is needed. There may be easier ways of doing this but I'd go with (something like)... \documentclass[varwidth, border=.75in]{standalone} \usepackage{lipsum} \usepackage{xcolor} \usepackage{graphicx} \begin{document} {\Large\bfseries Title} \emph{Subtitle} \vskip1ex \valign{&\vfil#\cr \hsize=0pt ...



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