4

I found this LaTeX template online on this link https://www.sharelatex.com/templates/other/us-patent

However, I could not find any way to add my TikZ diagrams into the drawing section. Also, I am not sure how to scale my figures that are in .jpg or .png. Please someone help me with this?

Thank you

1 Answer 1

4

How to add tikz diagrams

  • Put your tikz diagram (\begin{tikzpicture}...\end{tikzpicture}) into a file named e.g. TikzDrawing.tex. As an example, put the line

    \tikz\node[draw]{A};
    

    into this file. (This will draw a box with an A in it).

  • Add the following lines at the beginning of the document, near \begin{document}. In the ShareLaTeX template, you can add the lines to the file Drawings.tex that is included by the main document.

    \figureDefinition{TikzDrawing}
    \figureExtension{tex}
    \figureDescription{is an example drawing created with Tikz}
    
  • In the text of the patent, refer to the figure using

    \referencePatentFigure{TikzDrawing}
    

Then the reference is typeset as enter image description here and the TikZ picture appears in the appendix as

enter image description here

How to scale pdf/png/jpg figures

You have to add the following definitions to your preamble (i.e., between \documentclass[...]{...} and \begin{document}).

\documentclass[english]{uspatent}
\makeatletter
\def\figureOptions#1{%
\expandafter\ifx\csname anofigoptions \the\@annotationfigurenumber\endcsname\relax
\expandafter\def\csname anofigoptions \the\@annotationfigurenumber\endcsname{#1}
\else
\message{error while assigning option(s) ``#1'' to annotation figure number
``\the\@annotationfigurenumber'' - it was already defined as
``\annotationListFigureOptions{\the\@annotationfigurenumber}''.}\fi}
\def\annotationListFigureOptions#1{\csname anofigoptions #1\endcsname}
\def\showfigureincgraphics#1#2#3{%
\begin{figure}[!ht]
\centering
\edef\options{\annotationListFigureOptions{\csname fignum#1 \endcsname}}%
\expandafter\includegraphics\expandafter[\options]{#1.#2}\par
\figureReference{#1}~~#3 \par
\end{figure}
}
\expandafter\let\csname showfigure unk\endcsname\showfigureincgraphics
\expandafter\let\csname showfigure pdf\endcsname\showfigureincgraphics
\makeatother
\begin{document}

Now you can load all images with an extension acceptable to \includegraphics by adding lines like the following ones to Drawings.tex (or whereever you have your image definitions).

\figureDefinition{example-image}
\figureExtension{jpg}
\figureDescription{is an example jpg image with options}
\figureOptions{scale=0.5}

\figureDefinition{example-image-a}
\figureExtension{png}
\figureDescription{is an example png image with options}
\figureOptions{scale=0.5}

\figureDefinition{example-image-b}
\figureExtension{pdf}
\figureDescription{is an example pdf image with options}
\figureOptions{scale=0.5}

If we add these lines to the example document that comes with the template, we get the following output; see figures 3, 4, and 5.

enter image description here

enter image description hereenter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .