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}