添加大花括号和黑色标题背景

添加大花括号和黑色标题背景

我尝试使用添加括号

  1. \left{\begin{array}{@{}ll}但没有帮助。如何像图中这样将大支架添加到盖子上?

  2. 是否可以创建如图所示的黑色条纹Users-schema

源代码DEMO:https://www.sharelatex.com/project/5374a2ebeb2b8d651828ef64f

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\setlength\parindent{0pt}
\usepackage{xcolor}
\usepackage{setspace}
\begin{document}

\begin{center}
\textbf {User schema}
\end{center}

\setstretch{1.5}
\textbf {ID : }  \textcolor{red}{ObjectId }- Id do registro \\
\textbf {Name: } \textcolor{red}{ String  } - Name co usuario \\
\textbf {date: } \textcolor{red}{ Date } - Date de Cadastro \\
\textbf {ren\_date: } \textcolor{red}{ Date }  -  Data de 

\textbf {email: } \textcolor{red}{ String } - Lorem ipsum dolorsitamet, consecteturadipisicingelit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minimveniam, exercitationullamcolaborisnisi ut aliquipexeacommodoconsequat. Duisautereprehenderit in voluptatevelit esse cillumdolore eu fugiatnullapariatur. Occaecatcupidatat non proident, sunt in culpa quiofficiadeseruntmollit. 

\[
\text{accesslog: \textcolor{red}{ Array }}
  \left(
  \begin{array}{@{}ll}
  \left\{\begin{tabular}{l}
       \textbf{date}: \textcolor{red}{string}  Data -- da ocorrncia.\\
       \textbf{ObjectId}: \textcolor{red}{Usuário} --  que executou.\\
       \textbf{action}: \textcolor{red}{String} --  Aço Executada.\\
   \end{tabular}\right.\\
   ~\\
   \left\{
   \begin{tabular}{l}
         \textbf{date}: \textcolor{red}{string}  Data -- da ocorrncia.\\
         \textbf{ObjectId}: \textcolor{red}{Usuário} --  que executou.\\
         \textbf{action}: \textcolor{red}{String} --  Aço Executada.\\
   \end{tabular}\right.
   \end{array}
\right.
\]

\hyperlink{page.2}{\textbf {group\_id : }} \textcolor{red}{ ObjectId } - Id do  grupo. 

\pagebreak

\begin{center}
\textbf {Group schema}
\end{center}

\setstretch{1.5}

\textbf {ID : }  \textcolor{red}{ObjectId }- Id do registro \\
\textbf {Name: } \textcolor{red}{ String  } - Name co usuario \\
\textbf {date: } \textcolor{red}{ Date } - Date de Cadastro \\
\textbf {ren\_date: } \textcolor{red}{ Date }  -  Data de 

\textbf {email: } \textcolor{red}{ String } - Lorem ipsum dolorsitamet, consecteturadipisicingelit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minimveniam, exercitationullamcolaborisnisi ut aliquipexeacommodoconsequat. Duisautereprehenderit in voluptatevelit esse cillumdolore eu fugiatnullapariatur. Occaecatcupidatat non proident, sunt in culpa quiofficiadeseruntmollit. 

\[
\text{accesslog: \textcolor{red}{ Array }}
  \left(
  \begin{array}{@{}ll}
  \left\{\begin{tabular}{l}
       \textbf{date}: \textcolor{red}{string}  Data -- da ocorrncia.\\
       \textbf{ObjectId}: \textcolor{red}{Usuário} --  que executou.\\
       \textbf{action}: \textcolor{red}{String} --  Aço Executada.\\
   \end{tabular}\right.\\
   ~\\
   \left\{
   \begin{tabular}{l}
         \textbf{date}: \textcolor{red}{string}  Data -- da ocorrncia.\\
         \textbf{ObjectId}: \textcolor{red}{Usuário} --  que executou.\\
         \textbf{action}: \textcolor{red}{String} --  Aço Executada.\\
   \end{tabular}\right.
   \end{array}
\right.
\]

\textcolor{blue} { \textbf {group\_id : }} \textcolor{red}{ ObjectId } - Id do  grupo. 


\end{document}

结果应该是这样的:

在此处输入图片描述

答案1

应该让你开始:

在此处输入图片描述

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\setlength\parindent{0pt}
\usepackage{xcolor}
\begin{document}

\colorbox{black}{\makebox[\dimexpr\linewidth-2\fboxsep]{\color{white}\textbf {User schema}}}

\[
  \text{Users} \left\{ \begin{tabular}{@{}p{.8\linewidth}@{}}
    \textbf{ID}:  \textcolor{red}{ObjectId} -- Id do registro \\
    \textbf{Name}: \textcolor{red}{String} -- Name co usuario \\
    \textbf{date}: \textcolor{red}{Date} -- Date de Cadastro \\
    \textbf{ren\_date}: \textcolor{red}{Date} -- Data de \\
    \textbf{email}: \parbox[t]{.9\linewidth}{\raggedright\textcolor{red}{String} -- Lorem ipsum dolorsitamet, consecteturadipisicingelit, sed do 
      eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minimveniam, exercitationullamcolaborisnisi ut 
      aliquipexeacommodoconsequat. Duisautereprehenderit in voluptatevelit esse cillumdolore eu fugiatnullapariatur. Occaecatcupidatat 
      non proident, sunt in culpa quiofficiadeseruntmollit.\strut} \\
    \textbf{accesslog}: \textcolor{red}{Array} \begin{tabular}[t]{@{\ }|l@{}}
      \strut \\[-\normalbaselineskip]
      $\left\{\begin{tabular}{p{.7\linewidth}}
         \textbf{date}: \textcolor{red}{string} Data -- da ocorrncia. \\
         \textbf{user}: \textcolor{red}{ObjectId} -- que executou. \\
         \textbf{action}: \textcolor{red}{String} --  Aço Executada. \\
       \end{tabular}\right.\kern-\nulldelimiterspace$ \\
      $\left\{\begin{tabular}{p{.7\linewidth}}
         \textbf{date}: \textcolor{red}{string} Data -- da ocorrncia. \\
         \textbf{user}: \textcolor{red}{ObjectId} -- que executou. \\
         \textbf{action}: \textcolor{red}{String} -- Aço Executada. \\
       \end{tabular}\right.\kern-\nulldelimiterspace$
    \end{tabular}
  \end{tabular}\right.\kern-\nulldelimiterspace
\]

\end{document}

建议一致性以及易于更新,定义一个宏来格式化列表项。例如

\newcommand{\entry}[1]{\textbf{#1}:}
\newcommand{\entrytype}[1]{\textcolor{red}{#1}}

然后使用\entry{ID} \entrytype{ObjectId} -- ...

相关内容