我正在尝试使用 Tikz 添加框架。
我的示例在此位置不起作用:
\begin{tikzpicture}[overlay, remember picture]
\draw[line width=0.5mm]
($(current page.north west) + (20mm, -10mm)$)
rectangle
($(current page.south east) + (-10mm, 10mm)$);
\end{tikzpicture}
TeXStudio 中的编译选项:
lualatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex
如何在没有 Tikz 的情况下添加框架或如何修复它?
梅威瑟:
% !TeX program = lualatex
%==========================================================
\documentclass[14pt]{extarticle}
\usepackage{polyglossia}
%==========================================================
\usepackage{amsmath,amssymb}
\usepackage{unicode-math}
%==========================================================
\setdefaultlanguage[spelling=modern]{russian}
\setotherlanguage{english}
\setmonofont{Courier New}
\newfontfamily\cyrillicfonttt[Script=Cyrillic]{Courier New}[Scale=0.976]
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Times New Roman}
\newfontfamily\cyrillicfont{Times New Roman}[Scale=0.976]
\setsansfont{Arial}
\newfontfamily\cyrillicfontsf{Arial}[Scale=0.976]
\linespread{0.976}
%==========================================================
\usepackage[tracking=true]{microtype}
\microtypecontext{kerning=russian}
\usepackage[a4paper, left=25mm, right=15mm, top=20mm, bottom=20mm, headsep=0pt]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc, decorations.pathmorphing}
%==========================================================
\usepackage[section]{moodle}
\moodleset{ppi=100}
%==========================================================
\begin{document}
\begin{tikzpicture}[overlay, remember picture]
\draw[line width=0.5mm]
($(current page.north west) + (20mm, -10mm)$)
rectangle
($(current page.south east) + (-10mm, 10mm)$);
\end{tikzpicture}
~\vfill
\centerline{Title}
~\vfill
\thispagestyle{empty}
\newpage
\begin{quiz}{Section-1}
\begin{numerical}[points=2]{Basic addition}
What is $8+3$?
\item 11
\end{numerical}
\end{quiz}
\end{document}
答案1
该moodle
包加载了external
Ti 的库钾Z.因此,Ti钾Z 将尝试将tikzpicture
文档中的所有 s 外部化。这可能会导致问题,尤其是(但不仅限于)tikzpicture
使用overlay
和current page
节点的 s。另请参阅这个问题。
您可以通过在相关内容\tikzset{external/export next=false}
前添加以下内容来暂时禁用外部化tikzpicture
:
\documentclass[14pt]{extarticle}
\usepackage{tikz}
\usepackage[section]{moodle}
\moodleset{ppi=100}
\begin{document}
\tikzset{external/export next=false}
\begin{tikzpicture}[overlay, remember picture]
\draw[line width=0.5mm]
([shift={(20mm, -10mm)}]current page.north west)
rectangle
([shift={(-10mm, 10mm)}]current page.south east);
\end{tikzpicture}
~\vfill
\centerline{Title}
~\vfill
\thispagestyle{empty}
\newpage
\begin{quiz}{Section-1}
\begin{numerical}[points=2]{Basic addition}
What is $8+3$?
\item 11
\end{numerical}
\end{quiz}
\end{document}