\input{}
当我使用命令处理pdf_tex
子文件夹中 Inkscape 生成的文件时,出现了一个问题。它显示一条错误,内容为
! 包 pdftex.def 错误:未找到文件“X.pdf”:使用草稿设置。
但是,当我在同一文件夹中的文件中使用\input{}
命令时pdf_tex
,主文档问题不会出现。上述描述最初发生在带有主文件的报告中,在章节中我写了输入命令(使用\graphicspath{images/}
)
我附上了一个 MWE,它有与 Masterfile 相同的错误和相同的前言,以及带有错误的部分日志文件。顺便说一句,我正在使用 MiKTeX 和 Windows 10(2020 年安装的版本)。
代码:
%==================================PAQUETES INICIALES==================================%
%------------------------Clase de documento y configuraciones--------------------------%
\documentclass[10pt,a4paper,twoside]{report}
%--------------------------------------------------------------------------------------%
%-----------------------------Paquetes generales texto---------------------------------%
\usepackage{lmodern} %para codificaciones vectoriales T1 en vez de bitmap%
\usepackage[T1]{fontenc} %para poder copiar texto desde pdf con tildes%
\usepackage[utf8x]{inputenc} %tildes sin código%
\usepackage[spanish,mexico]{babel} %idiomas y cuadro->tabla%
\usepackage{anyfontsize} %cualquier tamaño de letra%
%--------------------------------------------------------------------------------------%
%-----------------------------Márgenes modificados-------------------------------------%
\usepackage[top=3cm,bottom=3cm]{geometry}
\setlength\oddsidemargin{\dimexpr(\paperwidth-\textwidth)/2 - 1in\relax} %Para márgenes
%laterales iguales en twoside document%
\setlength\evensidemargin{\oddsidemargin}
%--------------------------------------------------------------------------------------%
%--------------------------------Paquetes matemáticos----------------------------------%
\usepackage{amssymb,amsfonts,amsmath} %librerías matemáticas, símbolos y fuentes%
%--------------------------------------------------------------------------------------%
%----------------------------Paquetes gráficos y figuras-------------------------------%
\usepackage{graphicx} %gráficos%
%\usepackage{subfigure} %subfiguras%
\usepackage{float} %colocar figuras en posición arbitraria%
\usepackage{calc} %imagenes vectoriales svg%
%--------------------------------------------------------------------------------------%
%----------------------------Paquetes estilo y color-----------------------------------%
\usepackage[svgnames,x11names]{xcolor} %Paquetes de color%
\usepackage{color}
%colores por nombre en archivo y tablas%
\usepackage{fancyhdr} %cabeceras y pies de página%
\usepackage{fancybox} %cajas para parrafos, paginas, ecn, etc%
\usepackage{titlesec} %cambia estilo de capítulos%
%--------------------------------------------------------------------------------------%
%--------------Paquetes manipulación(tablas, listas, hipervínculos...)-----------------%
\usepackage{enumitem} %%listas identadas y numeradas%
\usepackage{nicematrix} % Paquete bonito para tablas, arreglos y figuras%
\usepackage{tikz} %Paquete super bonito para dibujar, por ahora auxiliar de nicematrix%
\usepackage{makecell} %para multirenglones \makerowcell{Parte 1\\Parte2}%
% saltos de linea en celdas de tablas \makecell{Parte 1\\Parte2}%
\usepackage{booktabs} %Para utilizar comandos de tablas elegantes%
\usepackage[export]{adjustbox} %Para ajustar altura de tablas%
\usepackage[colorlinks=true, linkcolor=blue, citecolor=green, bookmarks=true]{hyperref}
%referencias dentro del propio documento%
%======================================================================================%
\begin{document}
Pablito clavó un clavito en la calva de un calvito
\begin{figure}[H] %It appears correctly
\centering
\def \svgwidth{4cm}
\input{Mandala1.pdf_tex}
\end{figure}
\vspace{1cm}
\begin{figure}[H] %It appears correctly
\centering
\def \svgscale{0.2}
\input{Mandala1.pdf_tex}
\end{figure}
\begin{figure}[H]
\centering
\def \svgscale{0.4}
\input{images/musica.pdf_tex} %It doesn't appear -> Error
\end{figure}
\end{document}
日志文件的一部分:
...
File: uni-0.def 2013/05/13 UCS: Unicode data U+0000..U+00FF
)
(Mandala1.pdf_tex
<Mandala1.pdf, id=6, page=1, 623.32722pt x 622.83313pt>
File: Mandala1.pdf Graphic file (type pdf)
<use Mandala1.pdf, page 1>
Package pdftex.def Info: Mandala1.pdf , page1 used on input line 56.
(pdftex.def) Requested size: 113.81102pt x 113.72073pt.
) (Mandala1.pdf_tex
File: Mandala1.pdf Graphic file (type pdf)
<use Mandala1.pdf, page 1>
Package pdftex.def Info: Mandala1.pdf , page1 used on input line 56.
(pdftex.def) Requested size: 124.66353pt x 124.5644pt.
) (images/musica.pdf_tex
LaTeX Warning: File `musica.pdf' not found on input line 56.
! Package pdftex.def Error: File `musica.pdf' not found: using draft setting.
1
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.56 ...ics[width=\unitlength,page=1]{musica.pdf}}
%
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
...
答案1
如果要包含一个文件,而该文件又包含具有相对路径的其他文件,则可以使用包import
和\import
或\subimport
。在您的示例中,您将使用
\usepackage{import}
...
\import{images}{musica.pdf_tex}
代替
\input{images/musica.pdf_tex}