我对它的化学课程还很陌生,LaTeX
但还是被它吸引住了。因为这是我第一次使用这个课程LaTeX
来做报告,但这门课需要预实验需要提交的报告。总之,长话短说,这个实验室将需要一个很多数据,并希望在我的实验前报告副本中更好地组织它。而不是把它匆匆写在笔记本上。但是,它非常混乱,我不知道如何格式化它。我可以把\hrule
它想象成各种测量值,但一定有一种更简单的方法可以将所有内容填充到冒号前面最远的问题,这样所有内容都可以正确对齐。
也许有更好的方法来制作盒子,因为我渴望为未来的科学事业学习尽可能多的东西。
以下是有问题的区域:
\section*{Data}
Boiling point at first drop: \answerbox \\
Boiling point at last drop: \answerbox \\
Tared flask weight with decanted solution (1.0 mg): \answerbox \\
Mass of essential oil after evaporation: \answerbox \\
Percent of essential oil based on mass of caraway oil: \answerbox \\
Mass of 2,4-DNP (\ce{C16H18O4N4}): \answerbox \\
Melting point of 2,4-DNP: \answerbox \\
Amount of carvone originally extracted: \answerbox \\
Amount of limonene in the oil: \answerbox \\
Percent of limonene: \answerbox \\
Percent of carvone: \answerbox \\
\tikz \draw[fill=yellow!3] (0,0) rectangle (\linewidth, -2in) node[pos=.14] {Notes (Calculations/Odours):};
我的序言如下:
% Preamble
% -------------------------------------------------------------------------------
\documentclass{article}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\pagenumbering{roman}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}
% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}} % Horizontal rule
\makeatletter % Title
\def\printtitle{%
{\centering \@title\par}}
\makeatother
\makeatletter % Author
\def\printauthor{%
{\centering \large \@author}}
\makeatother
\newcommand\answerbox{%%
\fbox{\rule{2.5cm}{0pt}\rule[-0.2ex]{0pt}{2ex}}}
答案1
相当不错的‘黑客技术’;-)
我把描述放入一个comma separated list
显示为\MakeTable[options for answerbox]{width of description column}{width of answerbox}[Heading of notes box]<height of notes box>
可以添加更多功能,但需要时间;-)
\documentclass{article}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\pagenumbering{roman}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}
\usepackage[most]{tcolorbox}
% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\rule{\linewidth}{#1}} % Horizontal rule
\makeatletter % Title
\def\printtitle{%
{\centering \@title\par}}
\makeatother
\makeatletter % Author
\def\printauthor{%
{\centering \large \@author}}
\makeatother
\newcommand{\answerbox}[1][]{%
\begin{tcolorbox}[nobeforeafter,width=2.5cm,enhanced jigsaw,colback=white,sharp corners,#1]
\end{tcolorbox}
}
\usepackage{array}
\usepackage{xparse}
\newtcolorbox{notesbox}[2][]{nobeforeafter,boxrule=0pt,colback=white,enhanced jigsaw,sharp corners,width=\linewidth,height=#2,#1}
\ExplSyntaxOn
\clist_new:N \g_jon_topics_clist
\NewDocumentCommand{\FillTopicsList}{m}{%
\clist_set:Nn \g_jon_topics_clist {#1}
}
\NewDocumentCommand{\DisplayTopicsList}{O{}}{%
\clist_map_inline:Nn \g_jon_topics_clist { ##1: & \answerbox[#1] \tabularnewline}
}
\ExplSyntaxOff
\NewDocumentCommand{\MakeTable}{O{}mmO{Notes(Calculations/Odours}D<>{0.4\textheight}}{%
\begin{tabular}{m{#2}m{#3}}
\tabularnewline
\DisplayTopicsList[#1]
\tabularnewline
\hline
\multicolumn{2}{|l|}{%
#4
}\tabularnewline
\multicolumn{2}{|@{}l@{}|}{%
\begin{notesbox}[#1]{#5}
\end{notesbox}
}\tabularnewline
\hline
\end{tabular}
}
\begin{document}
\section*{Data}
\FillTopicsList{Boiling point at first drop,Boiling point at last drop,
Tared flask weight with decanted solution (1.0 mg),
Mass of essential oil after evaporation,
Percent of essential oil based on mass of caraway oil
Mass of 2,4-DNP (\ce{C16H18O4N4}),
Melting point of 2,4-DNP,
Amount of carvone originally extracted,
Amount of limonene in the oil,
Percent of limonene,
Percent of carvone,
}
\MakeTable{6cm}{2.5cm}<0.3\textheight>
\MakeTable[colback={yellow!40!white}]{6cm}{2.5cm}<0.3\textheight>
\end{document}