두 개의 수평 점선 사이에 텍스트를 수직으로 가운데 맞추는 방법

두 개의 수평 점선 사이에 텍스트를 수직으로 가운데 맞추는 방법

MWE는 대부분 설명이 필요하지 않습니다. 주어진 출력을 생성하는 명령을 만들고 싶습니다. 명령은 텍스트 위/아래의 공간을 지정하는 필수 인수를 사용해야 합니다. 텍스트는 소문자 작은 대문자입니다.

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} 

관련 정보