Thank-you for your quick response, and I apologize for my slow response. You're right. It's not a library problem. I was having a dollar sign problem. The code below works. However, if try to use

\node[and gate US, draw, logic gate inputs=nn] at ($(P)+(3,0)-(0,0.1)$) (and) {};

to place my add gate like I do in my slides, that results in an error. To do the arithmetic (P)+(3,0)-(0,0.1) to place the AND gate 3 right and 0.1 down of node (P), I need the dollar signs in my slides. Given that $ means string name in Perl, what symbol should I put around (P)+(3,0)-(0,0.1) to get tikz to do arithmetic to place the AND gate?

Looking at the example provided by Andrew Parker in this thread, I see another approach to placing nodes and gates, but I'm wondering if my current approach can be modified for WeBWorK.

DOCUMENT();

loadMacros(

"PGstandard.pl", # Standard macros for PG language

"MathObjects.pl",

"PGML.pl",

"PGtikz.pl",

#"source.pl", # allows code to be displayed on certain sites.

"PGcourse.pl", # Customization file for the course

);

# Print problem number and point value (weight) for the problem

TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect

$showPartialCorrectAnswers = 1;

##############################################################

#

# Setup

#

#

Context("Numeric");

$my_graph = createTikZImage();

$my_graph -> tikzLibraries("shapes,decorations,arrows,calc,fit,positioning,arrows.meta,circuits.logic.US");#from slides

#need to look at what libraries I really need

$my_graph -> tikzOptions(" ");

$my_graph -> addToPreamble(" ");

$my_graph->BEGIN_TIKZ

\node (P) at (0,1) {P};

\node (Q) at (0,0) {Q};

\node[and gate US, draw, logic gate inputs=nn] at (2,.9) (and) {};

%\node[and gate US, draw, logic gate inputs=nn] at ($(P)+(3,0)-(0,0.1)$) (and) {};

\draw (P) -- (and.input 1);

\draw (Q) -- (1.5,0) |- (and.input 2);

END_TIKZ

#using testing suggestion

$image = image($my_graph, width => 300, tex_size => 1000);

##############################################################

#

# Text

#

#

BEGIN_PGML

**Having problems with \$ **

Trying to draw a circuit.

[@ $image @]*

END_PGML

ENDDOCUMENT();