盒子
属性
name | description |
---|---|
基准点 | 垂直方向上某一点 |
高度 | 基准点到顶部距离 |
深度 | 基准点到底部距离 |
宽度 | 盒子宽度 |
总高 | 高度+深度 |
命令
盒子都是单行模式
command | type | description |
---|---|---|
\mbox{object} | 属性跟随 | |
\fbox{object} | 带框盒子 | 框线:0.4pt 框到对象: 3pt |
\makebox[width][location]{object} | 指定宽度和位置 | l :左对齐r : 右对齐c :居中s :均匀省略宽度就必须省略位置 |
\framebox[offset][width][location]{object} | 同上 | |
\raisebox[width][location]{object} | 上下盒子 | 以基准点,offset 偏移正向上,负向下 |
\fboxrule=width | 框线粗细 | 默认0.4pt |
\fboxsep=width | 框线到对象距离 | 默认3pt |
类型
command | type | description |
---|---|---|
\ovalbox | 圆角边框 | \cornersize{ratio} \cornersize*{diam} |
\Ovalbox | 粗角边框 | 同上 |
\shadowbox | 阴影边框 | 线宽\fboxrule ,默认0.4pt 阴影 \shadowsize ,默认4pt |
\doublebox | 双边框 | 内框线宽0.75\fboxrule 外框线宽 0.15\fboxrule 内外框距 1.5\fboxrule plus0.5pt |
段落
% 单行盒子
\parbox[location][height][innerheight]{width}{object}
% 段落盒子
\begin{minipage}[location][height][innerheight]{width}{object}
\end{minipage}
attribute | description | param |
---|---|---|
location | 基准线位置 | c :水平中线t :顶行对象b :底行对象 |
height | 对象高度 | 默认为对象高度 设定高度小于对象高度会凸出 |
innnerheight | 内部位置垂直对齐 | c :居中对齐t :顶部对齐b :底部对齐s :均匀分布 |
width | 宽度 |
\noindent id: 10010
\newlength{\sublength}
\settowidth{\sublength}{gender: female}
\begin{minipage}[t]{\sublength}
name: jackson
gender: female
family: none
\end{minipage}
线段
\rule[offset]{width}{height}
field | description |
---|---|
offset | 基线偏移,正上负下 |
width | 宽 |
height | 高 |
全黑的盒子,当宽度或者高度为0, 不可见,但是有支撑作用。
\newlength{\kidding}
\settowidth{\kidding}{Are you kidding me?}
\parbox{\kidding}{Are you kidding me? \par \rule[mm]{\kidding}{1pt}}
嵌套
\newlength{\msglength}
\settowidth{\msglength}{this is warning message!}
\fbox{\parbox{\msglength}{this is warning message!}} % 强调
测量
attr | description |
---|---|
\width | 宽 |
\height | 高 |
\depth | 深 |
\totalheight | \width + \depth |
\framebox[2\width]{content} %边框为内容两倍
\framebox[2\width]{content} \showthe\width % 运行时控制台打印
对象存取
command | description |
---|---|
\newsavebox{boxname} | 同\newlength{lengthname} |
\sbox{boxname}{object} | 将对象放入盒中 |
\savebox{boxname}[width][height]{object} | 同上 |
\usebox{boxname} | 使用盒子 |
\newsavebox{\abox} % 创建
\sbox{\abox}{\fbox{A}} % 填充
\usebox{\abox} % 调用
\usebox{\abox}
\usebox{\abox}
\usebox{\abox}
\usebox{\abox}
环境存取
\newsavebox{\FrameBox}
\begin{lrbox}{\FrameBox} % 相当于是把lrbox内定义的复杂对象赋给指定的box
\fbox{A}
\end{lrbox}
\usebox{\FrameBox}
跨页
\begin{bframe} % package: lineno
分页连续
\end{frame}