【问题标题】:voucher budget constraint tikz凭证预算约束tikz
【发布时间】:2018-01-24 22:14:58
【问题描述】:

我从超级有用的指南 (from this link) 中获取了以下代码,并在 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}

【问题讨论】:

    标签: latex tikz economics


    【解决方案1】:

    您的文档有几个问题:

    • 我需要将\coordinate(x1’)at({\inc/\panew},0); 中的单引号替换为正确的ASCII 单引号\coordinate(x1')at({\inc/\panew},0);
    • 域间隔有一个;,而不是:\draw[thick,domain=1.2;\inc/\pa]plot(\bcv)node[below]{BudgetConstraint}; -> \draw[thick,domain=1.2:\inc/\pa]plot(\bcv)node[below]{BudgetConstraint};
    • 您的 \begin{quote} 永远不会关闭。

    修复这些问题后,文档编译成功(如果您有适当的图像)。这是一个sn-p:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-14
      • 2016-11-06
      • 1970-01-01
      • 1970-01-01
      • 2010-09-22
      • 2020-03-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多