MWE 基本上是不言自明的。我想创建一个产生给定输出的命令。该命令应采用强制参数,指定文本上方/下方的空间量。文本是小写小型大写字母。
\documentclass[11pt]{article}
\usepackage{graphicx}
\newcommand\oblongdot{\protect\resizebox{0.75pt}{3pt}{$\cdot$}}
\makeatletter
\newcommand\cdotfill{%
\leavevmode\cleaders\hb@[email protected]{\hss\oblongdot\hss}\hfill\kern\z@
}
\makeatother
\newcommand\cdotrule{\makebox[4in]\cdotfill}
\begin{document}
\begin{center}
\cdotrule \\
\textsc{\LARGE vertically centered text} \\
\cdotrule
\end{center}
\end{document}
灵感来自
答案1
这些点不是垂直居中的。您可以使用框\vcenter
来对齐材料。您可以修改\oblongdot
宏,如下所示:
\newcommand\oblongdot{\protect$\vcenter{\resizebox{0.75pt}{3pt}{$\cdot$}}$}
\documentclass[11pt]{article}
\usepackage{graphicx}
\newcommand\oblongdot{\protect$\vcenter{\resizebox{0.75pt}{3pt}{$\cdot$}}$}
\makeatletter
\newcommand\cdotfill{%
\leavevmode\cleaders\hb@[email protected]{\hss\oblongdot\hss}\hfill\kern\z@
}
\makeatother
\newcommand\cdotrule{\makebox[4in]\cdotfill}
\begin{document}
\begin{center}
\cdotrule \\
\textsc{\LARGE vertically centered text} \\
\cdotrule
\end{center}
\end{document}
答案2
我无法让你的宏与 hrule 一起工作——正如这里定义的——
https://tex.stackexchange.com/a/389279/197451
\documentclass[11pt]{article}
\usepackage{cellspace, tabularx, booktabs}
\usepackage[x11names]{xcolor}
\usepackage{garamondx}
\addparagraphcolumntypes{X}
\begin{document}
\begin{titlepage}
\setlength{\cellspacetoplimit}{11pt}
\setlength{\cellspacebottomlimit}{12pt}
\begin{center}
\huge \textit{Edward Lear}\vspace{10ex}
\Huge\bfseries
\begin{tabularx}{\linewidth}{S{>{\centering\arraybackslash}X}}
\toprule
\color{IndianRed3} The Pobble Who Has No Toes \\
\bottomrule
\end{tabularx}
\end{center}
\end{titlepage}
\end{document}