将森林扩大 1 个节点会破坏 PST 条形码图片

将森林扩大 1 个节点会破坏 PST 条形码图片

在处理另一个问题时,我意识到二维码在文档中是否起作用,只是在森林树中有所不同。

看起来,如果下面的 MWE 中 Forest 的倒数第二个节点 (Child10) 被取消注释,QR 码就会损坏(顶部部分被抹去)。如果最后一个节点 (Child11) 被取消注释,那么 QR 码就会消失。

使用常规 JPG 图像替换 PST 条形码二维码可以产生正确的渲染,即 PST 条形码是根本原因。

由于森林是机器生成的,可以是任意大小,因此它必须属于独立类。因此我无法硬编码任何大小,包括纸张大小,并且必须将其打印在多页上。

\documentclass[border=10pt]{standalone}
\usepackage{forest}
\usepackage{adjustbox}
\usepackage{pst-barcode}
\usepackage[crop=off]{auto-pst-pdf}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} 

\begin{document}

\begin{tabular}{l r}
\begin{tabular}[t]{@{}l@{}}
Title\\
Text\\
\end{tabular} &

\begin{adjustbox}{valign=t}
\begin{pspicture}(1.02in,1.02in)
    \psbarcode{http://localhost/Intranet/OrgChart.aspx?id=10509110}{version=5}{qrcode}
\end{pspicture}
\end{adjustbox} \\
 & \\
\multicolumn{2}{c}{
\begin{forest} 
for tree={
    draw=black, align=center, l sep=4ex, parent anchor=south, child anchor=north,
    node options={font=\footnotesize, minimum width=14em, minimum height=10ex, rounded corners=1ex},
    edge path={
        \noexpand\path[\forestoption{edge}]
        (!u.parent anchor) -- +(0,-2ex) -| (.child anchor)\forestoption{edge label};
    },
    where n children=0{
        child anchor=west,
        edge path={
            \noexpand\path[\forestoption{edge}]
            ([xshift=-6em]!u.parent anchor) |- (.child anchor)\forestoption{edge label};
        },
        draw=red,for parent={
            parent anchor=south, l sep=-12em, grow'=east, calign=child edge, draw=blue          
        }
    }{}
}
    [Parent,name=Parent
        [Child1
            [,phantom]
            [Child11]
            [Child12]
        ]
        [Child3
            [,phantom]
            [Child31]
            [Child32]
        ]
        [Child4
            [,phantom]
            [Child41]
            [Child42]
        ]
        [Child5
            [,phantom]
            [Child51]
            [Child52]
        ]
        [Child6
            [,phantom]
            [Child61]
            [Child62]
        ]
        [Child7
            [,phantom]
            [Child71]
            [Child72]
        ]
        [Child8
            [,phantom]
            [Child81]
            [Child82]
        ]
        [Child9
            [,phantom]
            [Child91]
            [Child92]
        ]
%       [Child10
%           [,phantom]
%           [Child101]
%           [Child102]
%       ]
%       [Child11
%           [,phantom]
%           [Child111]
%           [Child112]
%       ]
    ]
\end{forest}
} \\
\multicolumn{2}{l}{
\begin{tiny}Copyright \textcopyright{} Myself, 2014\end{tiny}
}
\end{tabular}
\end{document}

答案1

这没有问题:运行pdflatex -shell-escape <file>

\documentclass[border=12pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage{ragged2e}
\usepackage[crop=off]{auto-pst-pdf}
\ifpdf
  \usepackage{forest}
\else
  \usepackage{pst-barcode}
\fi
\usepackage[utf8]{inputenc}

\begin{document}

\begin{tabular}{@{} l @{}}
\begin{tabular}[b]{@{} l}
Title\\
Text
\end{tabular}
\hfill
\raisebox{\dimexpr-\height+\ht\strutbox}{\begin{pspicture}[pgffunctions](1.02in,1.02in)
    \psbarcode{http://localhost/Intranet/OrgChart.aspx?id=10509110}{version=5}{qrcode}
\end{pspicture}}
\\
\begin{forest} 
for tree={
    draw=black, align=center, l sep=4ex, parent anchor=south, child anchor=north,
    node options={font=\footnotesize, minimum width=14em, minimum height=10ex, rounded corners=1ex},
    edge path={
        \noexpand\path[\forestoption{edge}]
        (!u.parent anchor) -- +(0,-2ex) -| (.child anchor)\forestoption{edge label};
    },
    where n children=0{
        child anchor=west,
        edge path={
            \noexpand\path[\forestoption{edge}]
            ([xshift=-6em]!u.parent anchor) |- (.child anchor)\forestoption{edge label};
        },
        draw=red,for parent={
            parent anchor=south, l sep=-12em, grow'=east, calign=child edge, draw=blue          
        }
    }{}
}
    [Parent,name=Parent
        [Child1
            [,phantom]
            [Child11]
            [Child12]
        ]
        [Child3
            [,phantom]
            [Child31]
            [Child32]
        ]
        [Child4
            [,phantom]
            [Child41]
            [Child42]
        ]
        [Child5
            [,phantom]
            [Child51]
            [Child52]
        ]
        [Child6
            [,phantom]
            [Child61]
            [Child62]
        ]
        [Child7
            [,phantom]
            [Child71]
            [Child72]
        ]
        [Child8
            [,phantom]
            [Child81]
            [Child82]
        ]
        [Child9
            [,phantom]
            [Child91]
            [Child92]
        ]
       [Child10
           [,phantom]
           [Child101]
           [Child102]
       ]
       [Child11
           [,phantom]
           [Child111]
           [Child112]
       ]
    ]
\end{forest}
\\
{\tiny Copyright \textcopyright{} Myself, 2014}
\end{tabular}

\end{document}

在此处输入图片描述

相关内容