For TikZ/PGF physics diagrams, the most reliable workflow is to use AI to generate editable TikZ code rather than a final image. This preserves mathematical correctness, enables systematic refinement, and supports consistent styling across an entire textbook with export-ready output (PDF/SVG/PNG).

Preferred Model
Use GPT-5.5 Thinking (or an equivalent model strong in LaTeX, TikZ/PGF, geometry, and physics reasoning).
Request compilable TikZ code, not “an image.”

Master Prompt Template

Copy-Paste Prompt

Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.

I am preparing a publication-quality applied physics textbook. Generate a clean, editable, black-and-white academic TikZ diagram for the following physics problem.

Problem:
[Write the full physics problem here]

Diagram requirements:

  1. Use TikZ/PGF only.
  2. Output complete compilable LaTeX code.
  3. Use the standalone document class.
  4. Keep the diagram clean, minimal, and suitable for a printed physics textbook.
  5. Use mathematically correct geometry.
  6. Use clear labels with LaTeX notation.
  7. Use arrows for vectors and forces.
  8. Use dashed construction lines where needed.
  9. Mark important angles, radii, axes, and reference directions.
  10. Avoid decorative or artistic elements.
  11. Use consistent line thickness.
  12. Keep labels well separated and readable.
  13. Do not use external images.
  14. Do not use unnecessary colors unless asked.
  15. Output only the LaTeX code.

Style preference:

  • White background
  • Black lines
  • Textbook-style force diagram
  • Large readable labels
  • Minimal but conceptually complete
  • Suitable for export as PDF/SVG
Best Prompt Formula

Physics situation
+ exact objects to draw
+ physical labels
+ required forces/vectors
+ construction lines
+ angle/radius markings
+ visual style
+ output format

Worked Prompt Examples

Example 1: Ball Sliding on a Fixed Sphere
Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.
Generate a clean, editable, black-and-white TikZ diagram for a classical mechanics problem.

Problem:
A small ball slides without friction on the outside surface of a large fixed sphere of radius R. The ball starts near the top and loses contact with the sphere at an angle theta measured from the vertical through the centre of the sphere.

Diagram requirements:
  1. Draw a large fixed sphere as a circle of radius R.
  2. Mark its centre as O.
  3. Place a small ball on the upper-right surface of the sphere.
  4. Draw the vertical radius from O to the top of the sphere as a dashed reference line.
  5. Draw the radius from O to the small ball.
  6. Mark the angle theta between the vertical radius and the radius to the ball.
  7. Draw the weight mg vertically downward from the small ball.
  8. Draw the normal reaction N radially outward from the sphere.
  9. Draw the velocity v tangentially downward along the surface.
  10. Label the radius R.
  11. Keep all labels readable and non-overlapping.
  12. Use black lines only.
  13. Use arrows with proper arrowheads.
  14. Use a clean academic textbook style.
  15. Output complete compilable LaTeX code using standalone class.
  16. Output only the code.
Example 2: Block on an Inclined Plane
Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.
Generate a clean TikZ force diagram for the following mechanics problem.

Problem:
A block of mass m is placed on a rough inclined plane making an angle theta with the horizontal. The coefficient of friction is mu. Draw the free-body diagram and show all relevant force components.

Diagram requirements:
  1. Draw an inclined plane at angle theta.
  2. Place a rectangular block on the plane.
  3. Draw weight mg vertically downward from the block.
  4. Draw normal reaction N perpendicular to the plane.
  5. Draw friction f along the plane opposite possible motion.
  6. Resolve weight into mg sin theta along the plane and mg cos theta perpendicular to the plane.
  7. Mark angle theta at the base of the inclined plane.
  8. Use dashed lines for component construction.
  9. Use clear LaTeX labels.
  10. Keep the figure uncluttered.
  11. Use black-and-white textbook style.
  12. Output complete compilable LaTeX code using standalone class.
  13. Output only the code.
Example 3: Simple Pendulum
Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.
Generate a clean academic TikZ diagram for a simple pendulum problem.

Problem:
A simple pendulum of length l is displaced by an angle theta from the vertical. The bob has mass m. Show the forces acting on the bob and the angular displacement.

Diagram requirements:
  1. Draw a fixed pivot point.
  2. Draw a dashed vertical reference line from the pivot.
  3. Draw the string of length l making angle theta with the vertical.
  4. Draw the bob at the end of the string.
  5. Draw tension T along the string toward the pivot.
  6. Draw weight mg vertically downward.
  7. Show the tangential component mg sin theta.
  8. Show the radial component mg cos theta if space permits.
  9. Mark angle theta clearly near the pivot.
  10. Label the length l.
  11. Use clean black lines.
  12. Avoid unnecessary decoration.
  13. Output complete standalone LaTeX TikZ code.
  14. Output only the code.
Example 4: Convex Lens Ray Diagram
Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.
Generate a clean TikZ ray diagram for geometrical optics.

Problem:
An object is placed beyond twice the focal length of a convex lens. Show image formation using principal rays.

Diagram requirements:
  1. Draw the principal axis.
  2. Draw a convex lens at the centre.
  3. Mark optical centre O.
  4. Mark focal points F and 2F on both sides.
  5. Draw an upright object on the left side beyond 2F.
  6. Draw the real inverted image between F and 2F on the right side.
  7. Draw one ray parallel to the principal axis refracting through the focus.
  8. Draw one ray through the optical centre undeviated.
  9. Use arrowheads on rays.
  10. Label object, image, F, 2F, and O.
  11. Keep the diagram clean and textbook-like.
  12. Use black-and-white style.
  13. Output complete compilable standalone LaTeX code.
  14. Output only the code.
Example 5: Charged Particle in Magnetic Field
Act as an expert physics illustrator and LaTeX TikZ/PGF diagram designer.
Generate a clean TikZ diagram for an electromagnetism problem.

Problem:
A positive charged particle enters a uniform magnetic field directed into the plane of the page with velocity v. Show the magnetic force and resulting circular motion.

Diagram requirements:
  1. Draw a rectangular region containing crosses to represent magnetic field into the page.
  2. Label the region as B into the page.
  3. Draw a positive charged particle entering from the left.
  4. Draw its initial velocity v to the right.
  5. Draw magnetic force F = qvB upward or downward according to the right-hand rule.
  6. Draw a circular arc showing the beginning of circular motion.
  7. Mark the radius r of the circular path if space permits.
  8. Use clean arrowheads.
  9. Use black-and-white academic style.
  10. Output complete standalone LaTeX TikZ code.
  11. Output only the code.
Example 6: Rutherford Scattering Geometry
Role:
Act as an expert nuclear physics illustrator and LaTeX TikZ/PGF diagram designer. Generate a clean, publication-quality black-and-white TikZ diagram for Rutherford scattering.

Problem:
An alpha particle approaches a heavy nucleus with impact parameter b and is scattered through an angle theta. Show the incoming asymptotic direction, smooth Coulomb-deflected trajectory, impact parameter b, forward reference direction, scattering angle theta, and outgoing scattered direction clearly.

Image assets:
  1. Use nucleus.png for the heavy nucleus.
  2. Use alpha.png for the alpha particle.
  3. Assume both image files are placed in the same folder as the .tex file.
  4. Include \usepackage{graphicx}.

Main correction required:
The trajectory must look like a natural repulsive Coulomb-scattering orbit. It must not look like a wave, an S-shaped bend, or a straight line suddenly joined to a curve. The alpha particle should be smoothly repelled by the nucleus, not drawn as if it first dips toward the nucleus and then turns away.

Strict trajectory rules:
  1. Draw the complete alpha-particle path as one single smooth continuous Bézier curve.
  2. The incoming branch should approach horizontally from the far left at height b.
  3. The bending should begin gradually before the closest-approach region.
  4. The particle must bend away from the nucleus due to repulsive Coulomb interaction.
  5. The curve should pass above or beside the nucleus without crossing the nucleus icon.
  6. The closest-approach region should be smooth, convex, and free from kinks.
  7. The outgoing branch should smoothly approach an upward-right asymptotic direction.
  8. The outgoing arrowhead must be tangent to the final curved segment.
  9. Do not add a separate straight outgoing arrow unless it is exactly tangent and visually seamless.
  10. Do not allow any sharp corner, cusp, visible join, or unnatural downward dip near the nucleus.

Diagram requirements:
  1. Use the standalone document class.
  2. Place the heavy nucleus at the origin using \includegraphics{nucleus.png}.
  3. Label the nucleus as heavy nucleus below the icon with enough spacing.
  4. Place an alpha.png icon near the incoming branch and label it as alpha particle.
  5. Place a rotated alpha.png icon along the outgoing branch.
  6. Label the outgoing direction as scattered path near the final arrowhead.
  7. Show the impact parameter b as a vertical double-arrow from the nucleus level to the incoming asymptote.
  8. Place the label b beside the double-arrow, away from the nucleus label.
  9. Draw a dashed horizontal forward reference line on the right side only.
  10. The forward reference line must start from a point on the outgoing asymptotic region, not from the nucleus.
  11. Mark theta between the forward reference line and the outgoing tangent direction.
  12. Place the angle arc on the right side, away from the nucleus and away from the closest-approach region.
  13. Use clean black lines, proper Stealth arrowheads, and minimal dashed construction lines.
  14. Use a spacious academic textbook style.

Suggested Bézier construction:
\draw[curvepath]
(-5.5,1.4)
.. controls (-4.0,1.4) and (-2.5,1.42) .. (-1.45,1.35)
.. controls (-0.65,1.25) and (-0.15,1.05) .. (0.25,1.12)
.. controls (1.25,1.32) and (2.8,2.25) .. (4.8,3.25);
Preferred visual layout:
  1. Nucleus at (0,0).
  2. Incoming asymptote at height b above the nucleus.
  3. Incoming branch approaches horizontally from the far left.
  4. Deflection begins gradually before the closest-approach region.
  5. The curve passes above or beside the nucleus without touching it.
  6. The outgoing direction goes upward to the right as the natural tangent of the same curve.
  7. The scattering angle is drawn clearly on the right side between the forward reference line and the outgoing tangent direction.

Label-placement rules:
  1. Do not place labels inside the nucleus.
  2. Do not place labels on top of the trajectory, alpha icons, construction lines, or angle arc.
  3. Do not place theta too close to the nucleus.
  4. Use white-filled label backgrounds through a labelstyle.

Technical requirements:
  1. Use \documentclass[tikz,border=6pt]{standalone}.
  2. Use \usetikzlibrary{arrows.meta, angles, quotes, calc}.
  3. Define styles for trajectory, reference, measure, curvepath, and labelstyle.
  4. Do not use below=0.48cm of O unless the positioning library is loaded.
  5. Prefer coordinate-based placement, such as \node[labelstyle] at ($(O)+(0,-0.75)$) {heavy nucleus};.

Output:
Output complete compilable standalone LaTeX TikZ code only. Do not explain the code.

Revision Prompts for Iterative Improvement

Correction Prompt After TikZ Output
Improve the previous TikZ diagram.
Problems to fix:
1. [Mention issue 1]
2. [Mention issue 2]
3. [Mention issue 3]

Correction requirements:
1. Keep the same physical meaning.
2. Keep the code compilable.
3. Improve spacing and label readability.
4. Avoid overlapping labels.
5. Make arrows more physically accurate.
6. Keep black-and-white textbook style.
7. Output the complete corrected LaTeX code.
8. Output only the code.
Prompt for Book-Wide Style Consistency
Create a reusable TikZ style system for a physics textbook.
Requirements:
1. Define consistent styles for:
  - force arrows
  - velocity arrows
  - acceleration arrows
  - dashed construction lines
  - angle arcs
  - bodies
  - labels
  - coordinate axes
2. Use black-and-white academic style.
3. Make the styles suitable for mechanics, electromagnetism, optics, and nuclear physics diagrams.
4. Keep the style minimal and publication-ready.
5. Provide one example diagram using the styles.
6. Output complete compilable standalone LaTeX code.
7. Output only the code.