
我使用 Python 建立了一個繪圖matplotlib
,並將其儲存到 PGF,然後將其嵌入到我的 LaTeX 文件中。我希望它小一點,因為它不會居中,並且會迫使本應位於其上方的部分標題向下。
這是 pgf 文件的鏈接 http://www.fast-files.com/getfile.aspx?file=191033
\documentclass[12pt]{article}
\title{COMP 2823: Assignment 1}
\author{Student ID: 480380498}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{ulem}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\pagestyle{fancy}
\fancyhf{}
\rhead{SID: 480380498}
\begin{document}
...
\newpage
\section{}
Text \\
\begin{figure}
\begin{center}
\input{graph1.pgf}
\end{center}
\end{figure}
\end{document}
答案1
嘗試使用:
\documentclass[12pt]{article}
\title{COMP 2823: Assignment 1}
\author{Student ID: 480380498}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{ulem}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\pagestyle{fancy}
\fancyhf{}
\rhead{SID: 480380498}
\begin{document}
...
\newpage% why a newpage?
\section{without title?}
Text % don't use \\, leave a blank line to create a new paragraph
\begin{center}
\resizebox{\linewidth}{!}{\input{graph1.pgf}}
\end{center}
\end{document}
(未測試,因為我沒有 .pgf 檔案)。