The general syntax of TikZ
is to enter the stuff you want to be drawn in a format matching something like:
command [ options ] ( location ) { stuff } ;
Where almost everything might not be needed. Just the command
(e.g. draw
) and the trailing ;
to limit the scope of the command, are important. You forgot that ;
in the last line of your tikzpicture
and therefore get this error. And you forgot a at beginning of
draw
in the unidirectionAssociation
renaming block.
Use draw[umlcd style, ->] (#1) -- (#4)
instead of draw[umlcd style, ->] (#1) -- (#4)
The following compiles:
documentclass{standalone}
usepackage{pgf-umlcd}
renewcommand{unidirectionalAssociation}[4]
{
draw[umlcd style, ->] (#1) -- (#4)% <------
node[near end, auto]{#2}
node[near end, auto,swap]{#3};
}
begin{document}
begin{tikzpicture}
begin{abstractclass}[text width = 6cm]{FileStore}{0,0}
attribute{$sim$ com.alhelal.textpad}
operation{+ orderFile(file : File) : EditableFile}
operation[0]{# createFile(file : File) : EditableFile}
end{abstractclass}
begin{class}[text width = 6cm,anchor = west,xshift = 5cm]{ProgrammFileFactory}{FileStore.east}
inherit{FileStore}
attribute{$sim$ com.alhelal.textpad}
operation{+ orderFile(file : File) : EditableFile}
end{class}
begin{class}[text width = 11cm, yshift = -2cm]{EditableFile}{ProgrammFileFactory.south}
attribute{$sim$ com.alhelal.textpad}
attribute{+ languageBehavior : LanguageBehavior}
operation{+ options : Options}
operation{+ getCodeAreaFromTab(tb : Tab) : CodeArea}
operation{+ saveFile(fileTabArrayList : ArrayList$<$FileTab$>$, option : Options)}
operation{+ printFile(node : Node)}
operation{+ toggleLineNumber(cd : CodeArea)}
operation{+ setLanguageBehavior(langBehavior : LanguageBehavior)}
operation{+ performRunCode(file : File)}
operation{+ performBuildCode(file : File)}
operation{+ performSetHighlightableText()}
operation{+ performSetAutocompletableText()}
end{class}
begin{class}[text width = 3.5cm,anchor=north east,yshift = -2cm, xshift=-6cm]{TextFile}{EditableFile.south west}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
end{class}
begin{class}[text width = 3.5cm,anchor=north east,yshift = -2cm, xshift = -1.5cm]{CFile}{EditableFile.south west}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
attribute{-path : String}
end{class}
begin{class}[text width=3.5cm,anchor=north west,yshift = -2cm,xshift=-3cm]{CplusFile}{EditableFile.south}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
end{class}
begin{class}[text width = 3.5cm, anchor = north west, yshift = -2cm, xshift = -4cm]{JavaFile}{EditableFile.south east}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
end{class}
begin{class}[text width = 3.5cm,yshift = -2cm,xshift = 1cm]{PythonFile}{EditableFile.south east}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
end{class}
begin{class}[text width = 3.5cm, anchor = north west, yshift =-2cm,xshift = 5cm]{LaTeXFile}{EditableFile.south east}
inherit{EditableFile}
attribute{$sim$ com.alhelal.textpad}
end{class}
unidirectionalAssociation{ProgrammFileFactory}{}{$<<$instantiate$>>$}{EditableFile}
node [above=3mm] at (current bounding box.north) {Factory Method Pattern};% <-------
end{tikzpicture}
end{document}
I marked the lines I changed with % <-------
.
EDIT: I’ve updated the above code to include the correct redefinition of unidirectionalAssociation
thanks to the clarifications provided by @TorbjørnT.
Thank you for the response. I am a beginner in LATEX. I have learnt just a few things and trying it by just typing a sample article. In my article, I am trying to draw a block diagram after text in a subsection. I am trying it using tikz package.
The script is shared below. I am running this script with INTERNET OFF, getting the errors as :
! Package pgf Error: No shape named `N-point FFT’ is known.See the pgf package documentation for explanation.Type H <return> for immediate help….
! Package tikz Error: Giving up on this path. Did you forget a semicolon?.See the tikz package documentation for explanation.Type H <return> for immediate help…. end{tikzpicture}
! Undefined control sequence.<argument> pgf@baseline end{tikzpicture}
With the INTERNET ON, Neither Error nor Output is being displayed.
I am looking for some assistance please.
Script:
documentclass[10pt,onecolumn,a4paper]{article}
linespread{1.5}
title{PAPR reduction and non-linearity alleviation using hybrid of precoding and companding in a visible light communication (VLC) system}
%author{Nishant Sharan\S.K Ghorai}
usepackage{amssymb,amsmath}
usepackage{graphicx} % dvips destroys the tikzpicture to a mess
usepackage{tikz}
usetikzlibrary{shapes.geometric,arrows}
tikzstyle{startstop} = [rectangle, rounded corners, text centered, draw=black, fill=blue!10]
tikzstyle{process} = [rectangle, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=orange!10]
tikzstyle{decision} = [diamond, aspect=3, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=red!10]
% define arrow style
tikzstyle{compute} = [rectangle, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=green!10]
tikzstyle{estimate} = [rectangle, rounded corners, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=yellow!10]
tikzstyle{arrow} = [thick,->,>=stealth]
tikzstyle{block}=[draw,rectangle,node distance=8em]
begin {document}
%begin{flushleft}
maketitle
section*{Abstract}A hybrid technique using a precoder and a $mu$ law compander is proposed to alleviate light emitting diode(LED) non-linearity as well as peak-to average power ratio (PAPR) reduction in a VLC system.A $mu$ law compander is used to compress the peak valued signal and enhances small amplitudes to lower the PAPR. The work attains optimal PAPR and improves bit error rate (BER) of the system at low signal to noise values. The non-linear characteristic of a LED used as the transmitter in a VLC system leads to damaging effect whiole using OFDM in an optical system. The combination scheme improves LED non-linearity for low input backoff power(IBO). In the work,non-linearity is characterised using error vector magnitude (EVM) in percentage. The proposed method shows a 5 $%$ EVM improvement for 0dB IBO.The paper provides a choice for a trade-off among PAPR reduction,BER and reduced non-linearity.
section*{Keywords}OFDM,VLC,PAPR,Precodeing,Companding,BER
section{Introduction}
The high-speed wireless services such as high definition(HD)video and picture transmission, internet protocol (IP) based voice calls,online games and videos,e-commerce transactions,etc urge for the fast speed mobile data network.
section{Optical Modulation Schemes}
In this section,conventional ACO-OFDM,PAM-DMT and DCO-OFDM schemes as well as hybrid modulation schemes such as HACO-OFDM,ADO-OFDM and LACO-OFDM are described.
subsection{Conventional Schemes}
subsubsection{ACO-OFDM}In ACO-OFDM,only the odd sub-carriers carry data while the even sub carriers are set to zeros in the frequency domain.The input signal to the textit{N}-point IFFT,textbf{X},consists of only odd components and satisfies the Hermitian symmetry as textbf{X}=[0,Xtextsubscript{1},0,Xtextsubscript{3}…..,Xtextsubscript{N/2-1},0,Xtextsuperscript{*}textsubscript{N/2-1}….,Xtextsubscript{3},Xtextsubscript{1}].The time-domain signal xtextsubscript{n} has the antisymmetric property as xtextsubscript{n}= -xtextsubscript{n+N/2},(0$leq$ ntextless N/2).The ACO-OFDM signal, xtextsubscript{ACO,n},is ensured non-negative by clipping the negative part without losing any information as
begin{equation}
x_{Aco,n}=
begin{cases} x_{n}, &text{ $x_{n} geq 0$,}\
0, &text{ $ x_{n} < 0$.}\
end{cases}
end{equation}
In [11], it has been proved that the clipping noise only falls on the even sub-carriers,which will not affect the demodulation of the transmitted data.
subsubsection{PAM-DMT:}In PAM-DMT, signals drawn from PAM are used to modulate the imaginary part of each sub-carrier except the 0-th and N/2-th sub-carriers. The input to the IFFT block can be represented as
$textbf{Y}=0,Y_{1},Y_{2},ldots,Y_{N/2-1},0,Y^*_{n/2-1},ldots,Y^*_{1}$,
where $Y_{k}=ib_{k},b_{k}(k=1,2,ldots,N/2-1)$ is the real valued PAM signal and $i^2=-1$. As shown in [15], the time domain signal $y_{n}$ follows the symmetry as $y_{n}=-Y_{N-n},(0leqslant n < N/2)$.Therefore, PAM-DMT signal $y_{PAM,n}$ can be clipped at zero without any loss of information as
begin{equation}
y_{PAM,n}=
begin{cases} y_{n}, &text{ $y_{n} geq 0$,}\
0, &text{ $ y_{n} < 0$.}\
end{cases}
end{equation}
subsubsection{DCO-OFDM:}In DCO-OFDM,the signal $Z_{n}$ is generated by the IFFT is guaranteed is guaranteed to be positive by adding a DC bias, $B_{Dc}$. After the superposition, the remaining negative signal will be clipped at zero, leading to a clipping noise,ctextsubscript{n} which depends on DC bias. Then the transmitted DC-OFDM signal $Z_{DCO,n}$ is given by
begin{equation}
Z_{DCO,n}=
z_{n}+B_{DC}+C_{n}.
end{equation}
Moreover, $B_{DC}$ is usually relative to the electrical power of the signal $z_{n}$, and $B_{DC}=musqrt{E{Z_{n}^2}}$,where $mu$ is a proportional constant and $B_{DC}$ is defined as 10logtextsubscript{10}$(mu^2+1)$ dB.
subsection{Hybrid Schemes}
Figs.1 and 2 illustrate the transmitters and receivers of HACO-OFDM, ADO-OFDM and LACO-OFDM, respectively.
%begin{figure}centering
%the par is necessary after each text to make the baselineskip take effect
begin{tikzpicture}[node distance=1.5cm, auto]
node (start) [block] {N-point FFT};
node[block,right of= N-point FFT](process1){Process1}
end{tikzpicture}
%caption{Block diagram of Alfvenic aurora detection algorithm.}
label{fig:blockcv}
%end{figure}
end {document}
Solution 1
The following solution uses the plot
command to draw the curved lines. The chessboard like fields are created by drawing each second stripe in horizontal and vertical direction and the even odd rule
for filling.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}[
x=10mm,
y=10mm,
z={(2.5mm, 0)},
]
newcommand*{CylinderLength}{5}
newcommand*{CylinderRadius}{1}
newcommand*{HorizontalStripes}{5}
newcommand*{VerticalStripes}{10}
pgfmathsetmacro{HorizontalStripeAngle}{180/HorizontalStripes}
draw
(CylinderLength, CylinderRadius)
-- plot[domain=90:270, smooth, variable=t]
(0, {CylinderRadius*sin(t)}, {CylinderRadius*cos(t)})
-- ++(CylinderLength, 0)
plot[domain=0:360, smooth cycle, variable=t]
(CylinderLength, {CylinderRadius*sin(t)}, {CylinderRadius*cos(t)})
;
fill[black, even odd rule]
% Vertical stripes
foreach x in {2, 4, ..., VerticalStripes} {
plot[domain=90:270, smooth, variable=t]
({(x-1)*CylinderLength/VerticalStripes},
{CylinderRadius*sin(t)}, {CylinderRadius*cos(t)})
-- ++(CylinderLength/VerticalStripes, 0)
-- plot[domain=90:270, smooth, variable=t]
(x*CylinderLength/VerticalStripes,
{CylinderRadius*sin(-t)}, {CylinderRadius*cos(-t)})
-- cycle
}
% Horizontal stripes
foreach y in {2, 4, ..., HorizontalStripes} {
plot[domain=90+(y-1)*HorizontalStripeAngle:
90+y*HorizontalStripeAngle,
smooth, variable=t]
(0, {CylinderRadius*sin(t)}, {CylinderRadius*cos(t)})
-- ++(CylinderLength, 0)
-- plot[domain=-90-y*HorizontalStripeAngle:
-90-(y-1)*HorizontalStripeAngle,
smooth, variable=t]
(CylinderLength, {CylinderRadius*sin(-t)},
{CylinderRadius*cos(-t)})
-- cycle
}
;
end{tikzpicture}
end{document}
Remark to the comments, that a semicolon is missing. I cannot reproduce this error message with the versions posted below. The fill
command contains two foreach
loops, for the horizontal and vertical stripes, otherwise the trick with the even odd rule
would not work. Thus the semicolon for the fill
command is on line 49 right before the closing end{tikzpicture}
.
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
tikz.sty 2013/12/13 v3.0.0 (rcs-revision 1.142)
pgf.sty 2013/12/18 v3.0.0 (rcs-revision 1.14)
pgfrcs.sty 2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 2014/05/08 v1.15 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
pgfsys.sty 2013/11/30 v3.0.0 (rcs-revision 1.47)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.0 (rcs-revision 1.1)
pgffor.sty 2013/12/13 v3.0.0 (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********
Solution 2
Run with xelatex
or latex
->dvips
->ps2pdf
documentclass[pstricks,border=5pt]{standalone}
usepackage{pst-solides3d}
begin{document}
psset{Decran=15,viewpoint=20 -60 0 rtp2xyz}
begin{pspicture}(-1,-2)(5,2)
pstVerb{ /ELEMENT 0 store }
psSolid[object=cylindrecreux,h=5,r=1.5,RotY=90,ngrid=11 15,
fcol= 0 2 165 { (black) } for ]% for loop with step 2
end{pspicture}
end{document}
And the same for a 8×8 chessboard :
documentclass[pstricks,border=5pt]{standalone}
usepackage{pst-solides3d}
begin{document}
psset{Decran=15,viewpoint=20 -60 0 rtp2xyz}
begin{pspicture}(-1,-2)(7,2)
pstVerb{ /Element 0 store }
psSolid[object=cylindrecreux,h=8,r=1.5,RotY=90,ngrid=8 8,
fcol= 32 {
Element (black) /Element Element 2 add store
Element 8 mod 0 eq
{ /Element Element 1 add store }
{ Element 8 mod 1 eq { /Element Element 1 sub store } if } ifelse } repeat
]
end{pspicture}
end{document}
Related videos on Youtube
10 : 01
How to draw: Cylindrical object draw — Chess figure
22 : 00
01 : 55
31 : 00
Drawing Cylinders and Ellipses
06 : 34
CHESS BOARD | SOLIDWORKS TUTORIAL #1
Comments
-
I can draw the cylinder:
documentclass[border=5pt]{standalone} usepackage{tikz} usetikzlibrary{shapes.geometric} begin{document} begin{center} begin{tikzpicture} node [cylinder, black, rotate=180, draw, minimum height=5cm, minimum width=2cm] (c) {}; end{tikzpicture} end{center} end{document}
But, I can’t even draw a chessboard in the lateral area of cylinder, as in the following figure
-
Sidenote: In case you are making this for something actually related to chess: Keep in mind that the board is 8×8.
-
@DennisJaheruddin There are variations…
-
-
Heiko Oberdiek, Was very beautiful. But, when I compile, has an error on line 34: Package tikz Error: Giving up on this path. Did you forget a semicolon?.See the tikz package documentation for explanation.Type H <return> for immediate help…. }
-
@benedito I just copied and pasted the example and it worked fine. I am using TikZ 3.0.0.
-
I get the same error, «! Package tikz Error: Giving up on this path. Did you forget a semicolon?» on l.34 }
-
@PålGD It’s working fine for me, which TikZ version you are using?
-
@PàlGD, I am using version 3. 0, which I updated today, using Miktex Package Manager
-
Heiko Oberdiek, I may have forgotten something important in Tikz update 3. 0?
-
@HeikoOberdiek I’m using 2.10: tikz.sty 2010/10/13 v2.10 (rcs-revision 1.12)
-
@PålGD Then it might be a bug in the older TikZ version.
-
Heiko Oberdiek, I’m convinced that’s not the case on semicolons. But, I can’t find the error. Here I can’t see the beautiful drawing using your same codes. Happened the same error when I used an earlier version to 3. 0: could not compile. Strange, very strange, what increases my curiosity
-
Heiko Oberdiek, When I tried to compile for several distinct programs, the error appears only on line 34. The problem for me should there, on line 34
-
@benedito Line 34 is only the end of the
foreach
loop. I do not know, what your version of TikZ does not like, because I cannot reproduce your problem with my versions. Addlistfiles
at the begin of the file and compare the version list for differences. -
Heiko Oberdiek, please, unfortunately, after many attempts I still can’t solve the problem. I used the Texnicenter, TexMaker, Tex Studio and the error always appears on the same line 34. About the error:Paragrafh ended before[email protected] was incomplete<to be read again> par; Argument of [email protected] has an extra}<insert text> par etc.
-
@benedito Have you compared the versions? Are you using the same or newer versions?
-
Herbet- How do I change the number of square (home of the Board), for example, to 8 for 8 (usual chessboard)?
-
ngrid= 8 8
. But then you have to modify the color setting, you’ll get the number of the faces withnum=all
-
Heiko Oberdiek- I haven’t given up. I really like your drawing that I’m still trying to get it here.