다른 크기의 이미지 및 텍스트와 혼합된 경우 다른 페이지의 동일한 크기의 텍스트가 페이지 상단에서 동일한 거리에 있는지 확인하는 방법

다른 크기의 이미지 및 텍스트와 혼합된 경우 다른 페이지의 동일한 크기의 텍스트가 페이지 상단에서 동일한 거리에 있는지 확인하는 방법

THIS TEXT NEEDS TO BE ALIGNED내 한 페이지에는 book앞에 값이 오는 텍스트 만 있습니다 vspace. 또한 다른 페이지에는 일부 값, 다른 크기의 텍스트 및 이미지가 WITH THIS TEXT앞에 있는 일부 텍스트가 있습니다 . 페이지 상단에서 정확히 같은 거리에 있어야 하므로 두 페이지가 함께 쌓여 있으면 두 텍스트가 서로 올바르게 정렬 됩니다 . 현재 코드에서는 텍스트 와 이미지 높이에도 할당했습니다. 두 텍스트 앞에 있는 모든 요소의 세로 값의 총 개수를 동일하게 함으로써 필요한 텍스트가 페이지 상단에서 동일한 거리에 올바르게 정렬되기를 바랐지만 그렇지 않습니다! 내가 도대체 ​​뭘 잘못하고있는 겁니까? 페이지 중 하나에 내가 모르는 공간이 추가되어 있나요 ?vspaceTEXT BEFORE TEXT THAT NEEDS TO BE ALIGNEDexample-image-c
THIS TEXT NEEDS TO BE ALIGNEDWITH THIS TEXT
ex valuesvspaces\begin{titlepage}

% !TEX TS-program = LuaLaTeX
\documentclass[11pt,twoside,openany]{book}
\pagestyle{plain}
\usepackage[english, russian]{babel}
\usepackage{fontspec}
\setmainfont{EB Garamond}[
  SmallCapsFont={EB Garamond SC},
  SmallCapsFeatures={Letters=SmallCaps},
  Ligatures=TeX,
]
\usepackage{microtype}
\usepackage[shortcuts]{extdash}
\usepackage[pagewise]{lineno} 
\usepackage[
  paperwidth=6in,
  paperheight=9in,
  inner=15mm,
  top=15mm,
  outer=20mm,
  bottom=22mm,
  heightrounded,
]{geometry} 

\usepackage{lipsum}
\setlength{\parskip}{0pt} 
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{titlesec}

\titleclass{\chapter}{straight}
\titleformat{\chapter}[display]{\filcenter\normalfont\large}{\thechapter.}{6pt}{}
\titlespacing*{\chapter}{0pt}{30pt}{10pt plus 10pt}

\begin{document} 
\pagenumbering{gobble}
\frontmatter

% PAGE1
\vspace*{14ex} 
\begin{center}
        {\fontsize{4ex}{4ex}\bfseries{THIS TEXT NEEDS TO BE ALIGNED}\par} % TEXT THAT NEEDS TO BE ALIGNED
\end{center}
        \vspace{9ex}   
\AddToHook{shipout/background}{%
\put(0mm,-240mm){\ifnum\value{page}=0 \includegraphics[width=200mm,height=250mm,keepaspectratio]{example-image-a}\fi}
\put(60mm,-200mm){\ifnum\value{page}=0 \includegraphics[width=60mm,height=60mm,keepaspectratio]{example-image-b}\fi}
 }
\clearpage

% TITLE PAGE
\begin{titlepage}
        \centering
        \vspace*{6ex}
         {\scshape\fontsize{6ex}{6ex}{TEXT BEFORE TEXT THAT NEEDS TO BE ALIGNED}\par}
  \begin{center}
    \includegraphics[height=2ex,keepaspectratio]{example-image-c}
  \end{center}
        {\fontsize{4ex}{4ex}\bfseries{WITH THIS TEXT}\par} % TEXT THAT NEEDS TO BE ALIGNED
        \vspace{9ex}
        {\scshape\footnotesize{SOME RANDOM TEXT}\par}
        \vspace{3ex}
         {\scshape\footnotesize{SOME RANDOM TEXT}\par}
        \vspace{9ex}
        {\large SOME RANDOM TEXT\par}
        \vspace{50ex}
        {\footnotesize SOME RANDOM TEXT\par}
        \vspace{0ex}
        {\footnotesize SOME RANDOM TEXT\par}
        \vspace{0ex}
        {\footnotesize SOME RANDOM TEXT\par}
        \vspace{0ex}
        \vfill
 \title{SOME TITLE}
 \author{SOME AUTHOR}
\date{}
\end{titlepage}
\clearpage

\mainmatter

\pagenumbering{arabic}

\chapter{CHAPTER ONE}
\lipsum[1-1]
  
\end{document}

답변1

이 접근 방식은 "WITH THIS TEXT" 위에 있는 자료가 있는 상자를 사용하여 "THIS TEXT NEEDS TO BE ALIGNED" 이전에 필요한 수직 공간을 계산하여 두 문장을 정렬합니다.

씨

( \documentclass[11pt,oneside,openany]{book}pdf 파일을 열 때 두 페이지를 나란히 표시하는 데에만 사용합니다.)

업데이트됨후속 질문 후.

\documentclass[11pt,oneside,openany]{book}

\usepackage[english, russian]{babel}
\usepackage{fontspec}
\setmainfont{EB Garamond}

\usepackage{microtype}
\usepackage[shortcuts]{extdash}
\usepackage[pagewise]{lineno} 

\usepackage[
paperwidth=6in,
paperheight=9in,
inner=15mm,
top=15mm,
outer=20mm,
bottom=22mm,
heightrounded,
showframe % added showframe to display the margins
]{geometry} 

\usepackage{lipsum}
\setlength{\parskip}{0pt} 
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{titlesec}

\titleclass{\chapter}{straight}
\titleformat{\chapter}[display]{\filcenter\normalfont\large}{\thechapter.}{6pt}{}
\titlespacing*{\chapter}{0pt}{30pt}{10pt plus 10pt} 

% ************************************* added <<<<<<
\newsavebox{\upperspace}
    \savebox{\upperspace}{%
    \begin{minipage}[b][][t]{\textwidth}    
        \begin{titlepage}
            \centering
            \vspace*{6ex}
            {\scshape\fontsize{2ex}{2ex}\selectfont TEXT BEFORE TEXT THAT NEEDS TO BE ALIGNED\par}
            \begin{center}
                \includegraphics[height=2ex,keepaspectratio]{example-image-c}
            \end{center}
        \end{titlepage}
    \end{minipage}
}

\newlength{\hhbox}
\settoheight{\hhbox}{\usebox{\upperspace}}
% ************************************* 

\begin{document} 

\pagenumbering{gobble}
\frontmatter

% PAGE1
\vspace*{\dimexpr\the\hhbox-1em}% changed <<<<<<<<< 
{\centering

{\fontsize{4ex}{4ex}\selectfont\bfseries THIS TEXT NEEDS TO BE ALIGNED\par}% TEXT THAT NEEDS TO BE ALIGNED

\AddToHook{shipout/background}{%
\put(0mm,-0mm){\ifnum\value{page}=0 \includegraphics[width=200mm,height=250mm,keepaspectratio]{example-image-a}\fi}
\put(60mm,-0mm){\ifnum\value{page}=0 \includegraphics[width=60mm,height=60mm,keepaspectratio]{example-image-b}\fi}
}}

\clearpage

% TITLE PAGE
\begin{titlepage}
    \centering
    \usebox{\upperspace}
        
    {\fontsize{4ex}{4ex}\selectfont\bfseries WITH THIS TEXT\par} % TEXT THAT NEEDS TO BE ALIGNED
    \vspace{9ex}
    {\scshape\footnotesize{SOME RANDOM TEXT}\par}
    \vspace{3ex}
    {\scshape\footnotesize{SOME RANDOM TEXT}\par}
    \vspace{9ex}
    {\large SOME RANDOM TEXT\par}
    \vspace{50ex}
    {\footnotesize SOME RANDOM TEXT\par}
    \vspace{0ex}
    {\footnotesize SOME RANDOM TEXT\par}
    \vspace{0ex}
    {\footnotesize SOME RANDOM TEXT\par}
    \vspace{0ex}
    \vfill
    \title{SOME TITLE}
    \author{SOME AUTHOR}
    \date{}
\end{titlepage}
\clearpage

\mainmatter

\pagenumbering{arabic}

\chapter{CHAPTER ONE}
\lipsum[1-1]

\end{document}

그룹 내에서 사용할 경우 \fontsize{}{}\selectfont그룹을 닫기 전에 단락을 끝내야 합니다.

\selectfont새 항목을 발행할 때 글꼴 크기가 업데이트되는 동안 baselineskip단락이 를 사용 \par하거나 빈 줄로 끝날 때만 업데이트됩니다.

보다\fontsize{}{}는 어떻게 작동하나요?

관련 정보