Latex 凭证预算约束tikz

Latex 凭证预算约束tikz,latex,tikz,economics,Latex,Tikz,Economics,我从超级有用的指南中获取了以下代码,并在TeXstudio中运行它 [domain=0:5,range=4:5,scale=1,thick] \usetikzlibrary{calc}%all %Definelinearparametersforsupplyanddemand \def\inc{62}%Entertotalincome \def\pa{19.5}%Priceofx1 \def\pb{10}%Priceofx2. \def\pane

我从超级有用的指南中获取了以下代码,并在TeXstudio中运行它

 [domain=0:5,range=4:5,scale=1,thick]
    \usetikzlibrary{calc}%all
    %Definelinearparametersforsupplyanddemand
    \def\inc{62}%Entertotalincome
    \def\pa{19.5}%Priceofx1
    \def\pb{10}%Priceofx2.
    \def\panew{10.6}
    \def\ica{\x,{2/\x−20}}
    \def\icb{\x,{\sslp∗\x+\sint}}
    \def\bcv{\x,{(−\pa)/(\pb)∗\x+(\inc)/(\pb)}}
    \def\bcx{\x,{(5)/\x}}

    %Definecoordinates.
    \coordinate(x2)at(0,{\inc/\pb});
    \coordinate(x1)at({\inc/\pa},0);
    \coordinate(x1’)at({\inc/\panew},0);
    %Drawaxes,anddottedequilibriumlines.
    \draw[->](0,0)(6.2,0)node[right]{$x1$};
    \draw[->](0,0)(0,6.2)node[above]{$x2$};
    \draw[dashed](1.2,3.9)(0,3.9)node[left]{voucher};
    \draw[thick,domain=1.2;\inc/\pa]plot(\bcv)node[below]{BudgetConstraint};
    \draw[thick,color=purple,domain=1:5]plot(\bcx)node[below]{Indiff.Curve};
它应该是这样的:

但我有一个错误:

Paragraph ended before \tikz@plot@samples@recalc was complete.
包含完整系列的错误消息:

Paragraph ended before \tikz@plot@samples@recalc was complete.
Something's wrong--perhaps a missing \item. \subsection
Something's wrong--perhaps a missing \item. \subsection
Something's wrong--perhaps a missing \item. \subsection
Something's wrong--perhaps a missing \item. \subsection
Something's wrong--perhaps a missing \item. \subsubsection
Something's wrong--perhaps a missing \item. \subsubsection
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing } inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing \endgroup inserted. \end{figure}
Missing } inserted. \end{figure}
Undefined control sequence. \end{figure}
Missing number, treated as zero. \end{figure}
\begin{tikzpicture} on input line 111 ended by \end{figure}. \end{figure}
\begin{tikzpicture} on input line 111 ended by \end{document}. \end{document}
running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.15} into your preamble.
wrapfigure used inside a conflicting environment
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
Stationary wrapfigure forced to float
有什么建议吗?以下是完整的.tex代码:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simple Sectioned Essay Template
% LaTeX Template
%
% This template has been downloaded from:
% http://www.latextemplates.com
%
% Note:
% The \lipsum[#] commands throughout this template generate dummy text
% to fill the template out. These commands should all be removed when 
% writing essay content.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[12pt]{article} % Default font size is 12pt, it can be changed here

\usepackage{geometry} % Required to change the page size to A4
\geometry{a4paper} % Set the page size to be A4 as opposed to the default US Letter

\usepackage{graphicx} % Required for including pictures

\usepackage{float} % Allows putting an [H] in \begin{figure} to specify the exact location of the figure
\usepackage{wrapfig} % Allows in-line images such as the example fish picture]
\usepackage{mathtools}
\usepackage{pgfplots}

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template

\linespread{1.2} % Line spacing

%\setlength\parindent{0pt} % Uncomment to remove all indentation from paragraphs

\graphicspath{{Pictures/}} % Specifies the directory where pictures are stored

\begin{document}

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here

\center % Center everything on the page

\textsc{\Large University of Oxford}\\[1.5cm] % Name of your university/college
\textsc{\large Final Honours School of Philosophy, Politics \& Economics}\\[0.5cm] % Major heading such as course name
\textsc{\large Behavioural \& Experimental Economics}\\[1.5cm] % Minor heading such as course title

\HRule \\[0.6cm]
{ \Large \bfseries Mental Accounting \& Donations}\\[0.3cm] % Title of your document
\HRule \\[3cm]

\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
Marcus \textsc{Ashby} % Your name
\end{flushleft}
\end{minipage}
~
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
Prof. Johannes \textsc{Abeler} % Supervisor's Name
\end{flushright}
\end{minipage}\\[4cm]

{\large \today}\\[3cm] % Date, change the \today to a set date if you want to be precise

%\includegraphics{Logo}\\[1cm] % Include a department/university logo - this will require the graphicx package

\vfill % Fill the rest of the page with whitespace

\end{titlepage}

%----------------------------------------------------------------------------------------
%   TABLE OF CONTENTS
%----------------------------------------------------------------------------------------
 % Include a table of contents
\begin{abstract}
Mental accounting, a form of bounded rationality, is an influential theory of microeconomic behaviour. It has only recently been shown to play a significant role in distorting private consumption decisions and its predictions are strong. Fieldwork has shown that consumers experience inframarginal in-kind donations as distortionary, which violates the predictions of the standard model. This paper extends applies this body of research to private donations. Integrating the two literatures, I test whether mental accounting is a neglected alternative to ‘warm glow’ in explaining patterns of private donation which deviate from a model of pure altruism. A randomised controlled trial run on undergraduate students provides new evidence that mental accounting is responsible for this pattern of donation.
\end{abstract}
\newpage % Begins the essay on a new page instead of on the same page as the table of contents 

%----------------------------------------------------------------------------------------
%   INTRODUCTION
%----------------------------------------------------------------------------------------

\section{Introduction} % Major section
Here is an indifference curve that I might use:
\begin{quote}
\begin{tikzpicture}
\begin{axis}[
axis x line=bottom,
axis y line=left,
xmin=0, xmax=10, 
ymin=0, ymax=10,
xlabel={$y_r$},
ylabel={$y_d$},
ytick=\empty,
xtick={0},
]
\draw (axis cs:2.2,9.5) to [bend right=40] coordinate[pos=0.2] (l_i) (axis cs:8,2);
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}[domain=0:5,range=4:5,scale=1,thick]
\usetikzlibrary{calc}%all
%Definelinearparametersforsupplyanddemand
\def\inc{62}%Entertotalincome
\def\pa{19.5}%Priceofx1
\def\pb{10}%Priceofx2.
\def\panew{10.6}
\def\ica{\x,{2/\x−20}}
\def\icb{\x,{\sslp∗\x+\sint}}
\def\bcv{\x,{(−\pa)/(\pb)∗\x+(\inc)/(\pb)}}
\def\bcx{\x,{(5)/\x}}

%Definecoordinates.
\coordinate(x2)at(0,{\inc/\pb});
\coordinate(x1)at({\inc/\pa},0);
\coordinate(x1’)at({\inc/\panew},0);
%Drawaxes,anddottedequilibriumlines.
    \draw[->](0,0)(6.2,0)node[right]{$x1$};
    \draw[->](0,0)(0,6.2)node[above]{$x2$};
    \draw[dashed](1.2,3.9)(0,3.9)node[left]{voucher};
    \draw[thick,domain=1.2;\inc/\pa]plot(\bcv)node[below]{BudgetConstraint};
    \draw[thick,color=purple,domain=1:5]plot(\bcx)node[below]{Indiff.Curve};

\end{tikzpicture}

%------------------------------------------------

\subsection{Subsection 1} % Sub-section

\lipsum[1] % Dummy text

%------------------------------------------------

\subsection{Subsection 2} % Sub-section

\lipsum[2] % Dummy text

%------------------------------------------------

\subsubsection{Subsubsection 1} % Sub-sub-section

\lipsum[3] % Dummy text

\begin{figure}[H] % Example image
\center{\includegraphics[width=0.5\linewidth]{placeholder}}
\caption{Example image.}
\label{fig:speciation}
\end{figure}

%------------------------------------------------

\subsubsection{Subsubsection 2} % Sub-sub-section

\lipsum[4] % Dummy text

%----------------------------------------------------------------------------------------
%   MAJOR SECTION 1
%----------------------------------------------------------------------------------------

\section{Content Section} % Major section

\lipsum[5] % Dummy text

%------------------------------------------------

\subsection{Subsection 1} % Sub-section

\subsubsection{Subsubsection 1} % Sub-sub-section

\lipsum[6] % Dummy text

%------------------------------------------------

\subsubsection{Subsubsection 2} % Sub-sub-section

\lipsum[6] % Dummy text
\begin{wrapfigure}{l}{0.4\textwidth} % Inline image example
  \begin{center}
    \includegraphics[width=0.38\textwidth]{fish}
  \end{center}
  \caption{Fish}
\end{wrapfigure}
\lipsum[7-8] % Dummy text

%------------------------------------------------

\subsubsection{Subsubsection 3} % Sub-sub-section

\begin{description} % Numbered list example

\item[First] \hfill \\
\lipsum[9] % Dummy text

\item[Second] \hfill \\
\lipsum[10] % Dummy text

\item[Third] \hfill \\
\lipsum[11] % Dummy text

\end{description} 

%----------------------------------------------------------------------------------------
%   MAJOR SECTION X - TEMPLATE - UNCOMMENT AND FILL IN
%----------------------------------------------------------------------------------------

%\section{Content Section}

%\subsection{Subsection 1} % Sub-section

% Content

%------------------------------------------------

%\subsection{Subsection 2} % Sub-section

% Content

%----------------------------------------------------------------------------------------
%   CONCLUSION
%----------------------------------------------------------------------------------------

\section{Conclusion} % Major section

\lipsum[12-13]

%----------------------------------------------------------------------------------------
%   BIBLIOGRAPHY
%----------------------------------------------------------------------------------------

\begin{thebibliography}{99} % Bibliography - this is intentionally simple in this template

\bibitem[Figueredo and Wolf, 2009]{Figueredo:2009dg}
Figueredo, A.~J. and Wolf, P. S.~A. (2009).
\newblock Assortative pairing and life history strategy - a cross-cultural
  study.
\newblock {\em Human Nature}, 20:317--330.

\end{thebibliography}

%----------------------------------------------------------------------------------------

\end{document}

您的文档存在以下几个问题:

我需要在{\inc/\panew}0处替换\coordinatex1'中的单引号;到正确的ASCII单引号:\coordinatex1'at{\inc/\panew},0; 有一个;对于域间隔而不是a::\draw[thick,domain=1.2;\inc/\pa]plot\bcvnode[below]{BudgetConstraint};->\绘制[thick,domain=1.2:\inc/\pa]plot\bcvnode[below]{BudgetConstraint}; 您的\begin{quote}从未关闭。 解决这些问题后,如果您有适当的图像,文档将成功编译。下面是一个片段: