家庭作业表解决方案

家庭作业表解决方案

我想创建如下图所示的家庭作业表解决方案

在此处输入图片描述

我的代码

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}
\begin{document}

\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.8pt}}
\begin{center}
    {\Large \textbf{Big title N 1 }}\\
(small title)   
\end{center}
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.8pt}}
\begin{center}
{\large \fbox{Exercise} }
\end{center}
\noindent\rule{10cm}{0.8pt}\fbox{1}  \noindent\rule{10cm}{0.8pt}
show that $$\int_{}^{} $$
\noindent\rule{10cm}{0.8pt}\fbox{2}  \noindent\rule{10cm}{0.8pt}
\begin{itemize}
\item 
\item 
\end{itemize}
\noindent\rule{10cm}{0.8pt}\fbox{text}  \noindent\rule{10cm}{0.8pt}
\begin{itemize}
\item 
\item 
\end{itemize}

\noindent\rule{10cm}{0.8pt}\fbox{large text}  \noindent\rule{10cm}{0.8pt}

% document content here
\end{document}
  • 怎么做?

答案1

使用\fbox

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}

\newcommand{\centerbox}[1]% #1 = text
{\bgroup% use local definitions
  \parskip=0pt
  \sbox0{\fbox{#1}}
  \dimen0=\dimexpr 0.5\textwidth - 0.5\wd0\relax
  \par\noindent\rule{\dimen0}{0.8pt}\box0\rule{\dimen0}{0.8pt}\par
\egroup}

\begin{document}

\noindent{\rule{\textwidth}{0.8pt}}
\begin{center}
    {\Large \textbf{Big title N 1 }}\\
(small title)   
\end{center}
\noindent\rule{\textwidth}{0.8pt}
\begin{center}
{\large \fbox{Exercise}}
\end{center}
\centerbox{1}%
show that $$\int_{}^{} $$
\centerbox{2}
\begin{itemize}
\item
\item
\end{itemize}
\centerbox{text}
\begin{itemize}
\item 
\item 
\end{itemize}

\centerbox{large text}

% document content here
\end{document}

使用 TikZ(圆角)

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{tikz}

\newcommand{\centerbox}[1]% #1 = text
{\bgroup% use local definitions
  \parskip=0pt
  \parindent=0pt
  \sbox0{\tikz[baseline]{\node[draw,rounded corners,anchor=base]{#1};}}%
  \dimen0=\dimexpr 0.5\textwidth - 0.5\wd0\relax
  \par\rule{\dimen0}{0.8pt}\box0\rule{\dimen0}{0.8pt}\par
\egroup}

\begin{document}

\noindent{\rule{\textwidth}{0.8pt}}
\begin{center}
    {\Large \textbf{Big title N 1 }}\\
(small title)   
\end{center}
\noindent\rule{\textwidth}{0.8pt}
\begin{center}
\tikz[baseline]{\node[draw,rounded corners=0.8ex,anchor=base]{\large Exercise}}
\end{center}
\centerbox{1}%
show that $$\int_{}^{} $$
\centerbox{2}
\begin{itemize}
\item
\item
\end{itemize}
\centerbox{text}
\begin{itemize}
\item 
\item 
\end{itemize}

\centerbox{large text}

% document content here
\end{document}

使用 tcolorbox ( \tcbox)

\documentclass{article}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{tcolorbox}

\newcommand{\centerbox}[1]% #1 = text
{\bgroup% use local definitions
  \parskip=0pt
  \parindent=0pt
  \sbox0{\tcbox[tcbox raise base]{#1}}%
  \dimen0=\dimexpr 0.5\linewidth - 0.5\wd0\relax
  \par\rule{\dimen0}{0.8pt}\box0\rule{\dimen0}{0.8pt}\par
\egroup}

\begin{document}

\noindent\rule{\textwidth}{0.8pt}
\begin{center}
    {\Large \textbf{Big title N 1 }}\\
(small title)   
\end{center}
\noindent\rule{\textwidth}{0.8pt}
\begin{center}
\tcbox[tcbox raise base]{\large Exercise}
\end{center}
\centerbox{1}%
show that $$\int_{}^{} $$
\centerbox{2}
\begin{itemize}
\item
\item
\end{itemize}
\centerbox{text}
\begin{itemize}
\item 
\item 
\end{itemize}

\centerbox{large text}

% document content here
\end{document}

相关内容