2

XeLaTeX is used.

Problem: I have a note, which is now made to the table. It is used many times in the document , so there is a need in the writing environment (on such a note).

I need to note it was recorded in the main text( i.e. itemize ). Is it Possible to make such an environment?

MWE:

  \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}

I tried to write the environment, but it doesn't work:

%    \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}
%    } 

Why is the environment not work? what am I doing wrong?

4
  • 1
    What is the problem? What does not work?
    – user31729
    Nov 30, 2017 at 9:32
  • Yes, And I guess I did everything wrong
    – Mary
    Nov 30, 2017 at 9:35
  • You need to specify 3 arguments: \newenvironment{Note}[3] Nov 30, 2017 at 20:38
  • I don't understand how to do it. Given that the first and the last column shall not be filled, they are only for alignment. Write the text only in the middle column and I have no idea how to do it, because I've never wrote such complex macros
    – Mary
    Dec 5, 2017 at 13:57

1 Answer 1

2

As @John Kormylo said

You need to specify 3 arguments: \newenvironment{Note}[3]

it means that in the environment definition the number in brackets is a number of argument that are accepted by the environment. In the your example

%    \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}
%    } 

we could see three arguments: #1, #2, #3, so \newenvironment{Note}[1] must be changed to \newenvironment{NoteEnv}[3]. Your example of the new env does not correspond to the MWE, so I've made a simplified example.

BTW, your env example is created in a \newcommand style and it it is not clear how the content will be used (see NoteEnv (Your first argument, using newenvironment) in the MWE). I've made a command, see \Note command.

If you really need an environment, see the third example NoteEnvWithContent (Your first argument, using newenvironment with content), but I don't know, how to pass an argument to the end-enviromnent section

{
            \end{itemize}  & =( \\ %#2 \\ %<-- don't know, how to pass an argument 
        \end{tabular}
    \end{table}
} 

MWE

Result

\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}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .