I'm typesetting a drawing for an assignment, but I can only change what's in \begin{document} -- that is, I can't add any packages or make any changes in the preamble. Unfortunately, the platform I'm working on doesn't have tikz or pgfplots installed, so is there a way I can make basic drawings without using either package? (e.g. drawing squares and points)
Asked
Active
Viewed 1,214 times
2
Brian Lee
- 433
1 Answers
3
Assume the following:
xcoloris in your preamble, or you know how to define\colorlet;- you can copy files to the working directory (the one that
\includegraphicswill search in),
Then you can still \input necessary PGF files manually. For example
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\def\ProvidesPackageRCS#1$#2${}
\def\ProvidesFileRCS#1$#2${}
\long\def\AtBeginDocument#1{}
\def\RequirePackage#1{}
\def\EveryShipout#1{}
\makeatletter
\input{pgfutil-common.tex}
\input{pgfutil-latex.def}
\input{pgfsys.code.tex}
\input{pgfcore.code.tex}
\input{pgfsyssoftpath.code.tex}
\input{pgfsysprotocol.code.tex}
\input{pgfcorepathconstruct.code.tex}
A rectangle
\pgfpathrectangle{\pgfpoint{-60pt}{-5pt}}{\pgfpoint{60pt}{20pt}}
\pgfsetcolor{red}\pgfusepath{draw}
\pgfsetcolor{black}
$$$$
A point
\pgfpathcircle{\pgfpointorigin}{5pt}
\pgfusepath{fill}
$$$$
A curve
\pgfpathmoveto{\pgfpointorigin}
\pgfpathcurveto{\pgfpoint{10pt}{10pt}}{\pgfpoint{20pt}{-10pt}}{\pgfpoint{30pt}{00pt}}
\pgfusepath{draw}
\end{document}
You can further input TikZ if necessary.
\input pgffor.code.tex
A lot of points
\par\foreach\n in{1,...,200}{
\xdef\n{\n}
\pgfmathsetmacro\x{cos(\n r)*sqrt(\n)*10+200}\xdef\x{\x}
\pgfmathsetmacro\y{sin(\n r)*sqrt(\n)*10-100}\xdef\y{\y}
\pgfpathcircle{\pgfpoint{\x pt}{\y pt}}{2pt}
}
\pgfusepath{draw}
\vskip300pt
\input pgfmoduleplot.code.tex
\input tikz.code.tex
A plot
\tikz\draw[scale=3,domain=0:4,samples=300]plot({cos(3*\x r)},{sin(5*\x r)});
Symbol 1
- 36,855
-
-
-
@Zarko You were right. I added it when I was searching for the shortest list of
\input--- some files are supposed to be included by the root so they do not bother to make at letter again. – Symbol 1 Mar 12 '18 at 15:35 -
@Zarko I am not convinced. The first included file alone redefines the catcode of
@. If I take the code in the answer and remove\makeatletterand add a macro\fo@I get the errorUndefined \fo@and notundefined \fo, which clearly indicates that@is still considered a letter. Unless of course I am greatly misunderstanding something. – campa Mar 12 '18 at 15:40 -
@campa, sorry but this i can't find in answer code. probably i miss something. also i didn't test the solution (since i'm sure that shoved images are produced with this code. – Zarko Mar 12 '18 at 15:49


picturemode, which is in the LaTeX kernel. But without an example of what you need… – egreg Mar 11 '18 at 23:17pstricks? – Bernard Mar 11 '18 at 23:28\usepackage. – Symbol 1 Mar 12 '18 at 01:20\RequirePackage{tikz}after document begin? – Symbol 1 Mar 12 '18 at 06:13tikzorpstricks? – CarLaTeX Mar 12 '18 at 07:13