有人能告诉我如何删除灰色矩形和节点框架之间的空间,以便节点的文本与主文本齐平吗?
下面是使用 LuaLatex 的最小示例:
\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\setlength{\parindent}{0pt}
\usepackage[left=1.5cm ,right=1.5cm ,top=2.25cm,footskip=1cm,a4paper]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\tikzset{every node/.style={inner sep=0,outer sep=0,draw,line width=1sp}}
\begin{document}
\begin{tikzpicture}[background rectangle/.style={fill=lightgray}, show background rectangle]
\node[] (name) at (0,0) {Hello, World};
\end{tikzpicture}
\lipsum[1-9]
\end{document}
提前致谢!
答案1
您可以调整inner frame sep
:
\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\setlength{\parindent}{0pt}
\usepackage[left=1.5cm ,right=1.5cm ,top=2.25cm,footskip=1cm,a4paper]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\tikzset{every node/.style={inner sep=0,outer sep=0,draw,line width=1sp}}
\begin{document}
\begin{tikzpicture}[background rectangle/.style={fill=lightgray}, show background rectangle,inner frame sep=0pt]
\node[] (name) at (0,0) {Hello, World};
\end{tikzpicture}
\lipsum[1-9]
\end{document}