边缘带有十字(加号)标记的矩形节点

边缘带有十字(加号)标记的矩形节点

我想将工作区域划分为几个部分,然后用加号标记它们的边界。我可以分别执行此操作:

\documentclass{article}

\usepackage[margin=1in]{geometry}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.geometric}


\tikzset{quarterpage/.style={draw,text width=.47*\textwidth, minimum height=.5*\textheight, 
    minimum width=.5*\textwidth, text depth=.47*\textheight,  
    label={[yshift=8mm]below:\rule{.35\textwidth}{.7pt}}}   }
    
 
\newcommand{\posA}{($.5*(current page text area.north west)+.5*(current page text area)$)}
\newcommand{\posB}{($.5*(current page text area.north east)+.5*(current page text area)$)}
\newcommand{\posC}{($.5*(current page text area.south west)+.5*(current page text area)$)}
\newcommand{\posD}{($.5*(current page text area.south east)+.5*(current page text area)$)}
    

\begin{document}

\begin{tikzpicture}[remember picture, overlay]
\node[quarterpage]at\posA{Some text};  
\node[quarterpage]at\posB{Another card};
\node[quarterpage]at\posC{Something else};
\node[quarterpage]at\posD{And what in fact?};
\end{tikzpicture}

\newpage

\begin{tikzpicture}
  \node[name=s,shape=rectangle] {Rectangle\vrule width 1pt height 2cm};
  \foreach \anchor in
    {north west, north east,
     south west, south east}
     \draw[shift=(s.\anchor)] plot[mark=+,mark options = {scale= 5}] coordinates{(0,0)};
\end{tikzpicture}
\end{document}

但任何试图用第二张图片中的加号替换第一张图片中的线条的尝试都失败了。我应该如何混合这两个定义?

在此处输入图片描述

在此处输入图片描述

更准确的说:在第二个版本中,边是用节点的特征点来标记的。我可以把它设置在某处quarterpage/.style吗?

答案1

我不明白这种奇怪的事情和做事方式的目的,但这是可以做到的

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\tikzset{
quarterpage/.style={
text width=.47*\textwidth, minimum height=.5*\textheight+20pt, 
minimum width=.5*\textwidth+20pt, text depth=.47*\textheight,  
label={[yshift=8mm]below:\rule{.35\textwidth}{.7pt}},
inner sep=10pt, outer sep=0pt,
path picture={\path plot[mark=+, mark options={scale=5}] coordinates{
 ([above right=10pt]path picture bounding box.south west)
 ([above left =10pt]path picture bounding box.south east)
 ([below right=10pt]path picture bounding box.north west)
 ([below left =10pt]path picture bounding box.north east)
};}}}
\newcommand{\posA}{($.5*(current page text area.north west)+.5*(current page text area)$)}
\newcommand{\posB}{($.5*(current page text area.north east)+.5*(current page text area)$)}
\newcommand{\posC}{($.5*(current page text area.south west)+.5*(current page text area)$)}
\newcommand{\posD}{($.5*(current page text area.south east)+.5*(current page text area)$)}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\node[quarterpage]at\posA{Some text};  
\node[quarterpage]at\posB{Another card};
\node[quarterpage]at\posC{Something else};
\node[quarterpage]at\posD{And what in fact?};
\end{tikzpicture}
\end{document}

整页被分成四份,上面有文字和十字

答案2

您认为结果“失败”的原因是什么,这一点根本不清楚。当然,编译起来没问题。

猜猜看,你在寻找

[对目标图像 1 进行大胆猜测

如果是这样,你只需要inner sep=0pt, line width=0pt

相关内容