macOS下MiKTeX+TeXstudio编译含includegraphics的tex时\@tempa多余}报错求助
问题原因排查
错误1:
\graphicspath语法不符合规范
\graphicspath 命令要求每个搜索路径都要用独立的大括号包裹,你写的\graphicspath{Figures/} 是错误写法,正确写法为\graphicspath{{Figures/}},这个语法错误是触发你当前Argument of \@tempa has an extra }报错的最核心原因。
错误2:未加载
hyperref包就使用其专属命令
你代码里用到的\texorpdfstring、\href 都是hyperref宏包提供的功能,你没有在导言区加载这个包,会触发命令未定义、参数解析异常的问题,需要在导言区加一行\usepackage{hyperref}。
错误3:
\href邮箱链接格式错误
邮箱地址作为链接目标时需要加mailto:前缀,你写的\href{ibrar.ahmad@gmail.com}{Ibrar Ahmed} 属于格式错误,正确写法为\href{mailto:ibrar.ahmad@gmail.com}{Ibrar Ahmed}。
错误4:自定义命令未提前定义
你在\addresses里用到的\group、\deptname、\univname都是自定义变量,你没有提前对这些命令进行赋值定义,编译时会找不到对应命令触发报错,需要提前用\newcommand或者对应文档类要求的赋值方式定义这些变量。
修复后的参考代码
\documentclass[a4paper, 12pt, oneside]{Thesis} \usepackage{graphicx} \usepackage{hyperref} % 加载hyperref包 \graphicspath{{Figures/}} % 修正graphicspath语法 % 提前定义缺失的自定义命令,可根据实际需求修改内容 \newcommand{\group}{课题组名称} \newcommand{\deptname}{院系名称} \newcommand{\univname}{学校名称} \begin{document} \frontmatter \title{\vspace{+1cm}{\includegraphics[width=30mm]{logo.pdf}}\\ \vspace{+1cm} test} \authors{\texorpdfstring {\href{mailto:ibrar.ahmad@gmail.com}{Ibrar Ahmed}} % 修正href链接格式 {Ibrar Ahmed} } \addresses{\group\\\deptname\\\univname} \maketitle \end{document}
内容的提问来源于stack exchange,提问作者Ibrar Ahmed
相关产品推荐
相关产品推荐

