使用 XeLaTeX。
问题: 我有一个注释,现在已记在桌子上。它在文档中用到了很多次,所以在写作环境中有需要(就这样的注释)。
我需要注意它被记录在正文中(即 itemize)。是否可以创建这样的环境?
梅威瑟:
\documentclass[10pt, oneside, a4paper]{report}
\usepackage[left=2cm,right=1.5cm,
top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{tabu}
\usepackage[svgnames]{xcolor}
\definecolor{DarkBlue}{HTML}{0070C0}
\definecolor{Blue}{HTML}{1C8CCC}
\usepackage{multirow}
\usepackage{polyglossia}
\setmainfont[Ligatures=TeX]{Arial}
\usepackage{color,colortbl}
\usepackage[inline,shortlabels]{enumitem}
\definecolor{lightGray}{HTML}{E6E7E9}
\newcommand{\point}{\item[\textcolor{Blue}{\textbullet}]}
\newcommand\blue[1]{\textcolor{Blue}{\textbf{#1}}}
%--------------------------------------------
\begin{document}
\begin{table}[h!]
\hspace*{-2.23cm}
\centering
\begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
\rowcolor{lightGray}
& \begin{description}
\item \textcolor{Blue}{\textbf{NOTE}}
\item Category of alerts:
\end{description}
\begin{itemize}
\point \textcolor{Blue}{\textbf{A}} --- graphical information at the task station directly assigned to the function generating the alert is necessary, as decision support for the evaluation the alert related condition. Confirm alerts is only possible with control panel
\point \textcolor{Blue}{\textbf{B}} --- no additional information for decision support is necessary besides the information which can be presented at the central alert management HMI. Confirm alerts is only possible from external alert management system
\end{itemize} & \\
\end{tabular}
\end{table}
\end{document}
我尝试写环境,但是没有用:
% \newenvironment{Note}[1]
% {
% \hspace*{-2.23cm}
% \centering
% \rowcolor{gray}
% \begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
%
% {#1} & {\begin{description}
% \item \blue{NOTE}
% \end{description}}
% \begin{description}
% \point {#2}
% \end{description}}
% & {#3} \\
% }
% {
% \end{tabular}
% }
为什么环境不起作用?我做错了什么?
答案1
正如 @John Kormylo 所说
您需要指定 3 个参数:
\newenvironment{Note}[3]
这意味着在环境定义中,括号中的数字是环境接受的参数数量。在您的示例中
% \newenvironment{Note}[1]
% {
% \hspace*{-2.23cm}
% \centering
% \rowcolor{gray}
% \begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
%
% {#1} & {\begin{description}
% \item \blue{NOTE}
% \end{description}}
% \begin{description}
% \point {#2}
% \end{description}}
% & {#3} \\
% }
% {
% \end{tabular}
% }
我们可以看到三个参数:#1
,,,,因此必须更改为。您的新#2
环境示例与 MWE 不对应,因此我做了一个简化的示例。#3
\newenvironment{Note}[1]
\newenvironment{NoteEnv}[3]
顺便提一句,您的 env 示例是按照\newcommand
样式创建的,并且不清楚内容将如何使用(请参阅NoteEnv (Your first argument, using newenvironment)
MWE)。我已经创建了一个命令,请参阅\Note
命令。
如果你确实需要一个环境,请参见第三个示例NoteEnvWithContent (Your first argument, using newenvironment with content)
,但我不知道如何将参数传递给最终环境部分
{
\end{itemize} & =( \\ %#2 \\ %<-- don't know, how to pass an argument
\end{tabular}
\end{table}
}
平均能量损失
\documentclass[10pt, oneside, a4paper]{report}
\usepackage[left=2cm,right=1.5cm,
top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{tabu}
\usepackage[svgnames]{xcolor}
\definecolor{DarkBlue}{HTML}{0070C0}
\definecolor{Blue}{HTML}{1C8CCC}
\usepackage{multirow}
\usepackage{polyglossia}
\setmainfont[Ligatures=TeX]{Arial}
\usepackage{color,colortbl}
\usepackage[inline,shortlabels]{enumitem}
\definecolor{lightGray}{HTML}{E6E7E9}
\newcommand{\point}{\item[\textcolor{Blue}{\textbullet}]}
\newcommand\blue[1]{\textcolor{Blue}{\textbf{#1}}}
\newenvironment{NoteEnv}[3]
{
\begin{table}[h!]
\hspace*{-2.23cm}
\centering
\begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
\rowcolor{lightGray}
& \begin{description}
\item \textcolor{Blue}{\textbf{NOTE}}
\item #1:
\end{description}
\begin{itemize}
\point #2
\end{itemize} & #3 \\
\end{tabular}
}
{
\end{table}
}
\newenvironment{NoteEnvWithContent}[2]
{
\begin{table}[h!]
\hspace*{-2.23cm}
\centering
\begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
\rowcolor{lightGray}
& \begin{description}
\item \textcolor{Blue}{\textbf{NOTE}}
\item #1:
\end{description}
\begin{itemize}
}
{
\end{itemize} & =( \\ %#2 \\ %<-- don't know, how to pass an argument
\end{tabular}
\end{table}
}
\begin{document}
\newcommand{\Note}[3]
{
\begin{table}[h!]
\hspace*{-2.23cm}
\centering
\begin{tabular}{p{1.5cm}p{17.5cm}p{7.85cm}}
\rowcolor{lightGray}
& \begin{description}
\item \textcolor{Blue}{\textbf{NOTE}}
\item #1:
\end{description}
\begin{itemize}
\point #2
\end{itemize} & #3 \\
\end{tabular}
\end{table}
}
\Note{Your first argument, using newcommand}{Your second argument}{3rd}
\begin{NoteEnv}{Your first argument, using newenvironment}{Your second argument}{last}
content...
\end{NoteEnv}
\begin{NoteEnvWithContent}{Your first argument, using newenvironment with content}{last}
\point \textcolor{Blue}{\textbf{A}} --- graphical information at the task station directly assigned to the function generating the alert is necessary, as decision support for the evaluation the alert related condition. Confirm alerts is only possible with control panel
\point \textcolor{Blue}{\textbf{B}} --- no additional information for decision support is necessary besides the information which can be presented at the central alert management HMI. Confirm alerts is only possible from external alert management system
\end{NoteEnvWithContent}
\end{document}