我的文档上有一个 TikZ 定义的注释框:
\newenvironment{mynotefortab}[1]
{\par\medskip\noindent
\begin{tikzpicture}
\node[inner sep=0pt] (box) {\parbox[t]{.99\textwidth}{%
\begin{minipage}{.1\textwidth}
\centering\tikz[scale=2]\node[scale=1]{\bcinfo};
\end{minipage}%
\begin{minipage}{.3\textwidth}
\textbf{#1}
\par\smallskip
\BODY
\end{minipage}\hfill}%
};
\draw[blue!75!black,line width=1pt]
( $ (box.north east) + (-2pt,1pt) $ ) -- ( $ (box.north east) + (0,1pt) $ ) -- ( $ (box.south east) + (0,-1pt) $ ) -- + (1pt,0);
\draw[blue!75!black,line width=1pt]
( $ (box.north west) + (2pt,1pt) $ ) -- ( $ (box.north west) + (0,1pt) $ ) -- ( $ (box.south west) + (0,-1pt) $ ) -- + (2pt,0);
\end{tikzpicture}\par\medskip%
}
当我在任何其他元素之外调用它时,它工作得很好。但我希望它也适合在文档开头定义的表格结构中:
\newcommand{\mystarttable}{\renewcommand{\arraystretch}{2}\begin{tabular}{| >{\centering\arraybackslash}m{3.4cm}| m{10cm}|}\hline}
\newcommand{\mystoptable}{\end{tabular}}
\newcommand{\myrow}[2]{ #1 \\ \hline }
\newcommand{\myitem}[1]{\item #1}
因此,当我调用如下命令时:
\mystarttable
\myrow{\textbf{mywhat}}{\mynotefortab{mynote}}
\mystoptable
我希望注释框能够适合表格结构,而不会在编译时引发任何错误或警告,现在没有绘制正确的线并且引发错误:
Underfull \hbox (badness 6461) in paragraph at lines 513--513
[] \T1/DejaVuSansCondensed-TLF/b/n/10 CC er-rors could be
! Undefined control sequence.
<argument> ...duplicated. } \par \smallskip \BODY
\end {minipage}\hfill \@@par
l.513 }
为了完整起见,我在我的文档中导入了以下库:
\documentclass[twoside,a4paper]{report}
\usepackage{fancyhdr, graphicx}
\usepackage{makeidx}
\usepackage{ifthen}
\usepackage{framed}
%\usepackage{xcolor}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{environ}
\usepackage[tikz]{bclogo}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{DejaVuSansCondensed}
\usepackage{geometry}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{etoolbox}
\usepackage[utf8]{inputenc}