
내 텍스트를 특정 위치의 특정 크기 "상자"에 맞추고 싶습니다. 내가 겪고 있는 두 가지 문제는 다음과 같습니다.
이 긴 문자열은 4.5인치 제한에 도달하면 감싸져야 하지만 그렇지 않습니다.
\documentclass[landscape]{article}
\usepackage[top=1.5in, bottom=1.125in, left=.25in, right=6.25in,textwidth=4.5in, textheight=5.875in]{geometry}
\begin{document}
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
\end{document}
그리고 이것은 일정하게 유지되지만 텍스트를 확대하여 상자에 맞게 만드는 것처럼 전체 4.5in x 5.875in 상자에 맞게 강제로 적용하고 싶습니다.
\documentclass[landscape]{article}
\usepackage[top=1.5in, bottom=1.125in, left=.25in, right=6.25in,textwidth=4.5in, textheight=5.875in]{geometry}
\begin{document}
{\Huge This should fit in a 4.5in x 5.875in box but that is close to the left edge of paper, but it is not conforming to the box size desired....
\end{document}
도와 주셔서 감사합니다.
답변1
이것은 다음을 위한 직업이 될 수 있습니다.핏박스패키지 옵션 tcolorbox
. 설명했듯이 첫 번째 텍스트에는 하이픈이 필요합니다. 그러나 두 번째 텍스트는 다음 코드를 사용하여 크기를 조정할 수 있습니다. 4.5in x 5.875in 상자를 표시하기 위해 노란색 배경을 추가했습니다.
lmodern
글꼴 크기 조정 메커니즘을 활성화하기 위해 확장 가능한 글꼴 패키지( )를 포함했습니다 .
\documentclass[landscape]{article}
\usepackage[top=1.5in, bottom=1.125in, left=.25in, right=6.25in,textwidth=4.5in, textheight=5.875in]{geometry}
\usepackage{lmodern}% for scalable fonts!
\usepackage[many]{tcolorbox}
\begin{document}
\tcboxfit[blank,width=4.5in,height=5.875in,
fit basedim=20pt,fit fontsize macros,valign=center,
frame style={fill=yellow!50!white}% remove this line to remove the yellow background
]%
{\Huge This should fit in a 4.5in x 5.875in box but that is close to the left edge of paper, but it is not conforming to the box size desired....}
\end{document}
첫 번째 코드는 주어진 상자 안의 텍스트에 맞게 글꼴을 조정합니다. 그래도 상자 상단과 하단에는 아주 작은 빈 공간이 두 개 남아 있습니다. 이를 제거하는 것이 중요하다면 다음 코드를 사용하여 최종 스트레칭을 추가할 수 있습니다. 외부 상자는 단지 예제를 색칠하기 위한 것입니다.
\documentclass[landscape]{article}
\usepackage[top=1.5in, bottom=1.125in, left=.25in, right=6.25in,textwidth=4.5in, textheight=5.875in]{geometry}
\usepackage{lmodern}% for scalable fonts!
\usepackage[many]{tcolorbox}
\begin{document}
\tcbox[blank,width=4.5in,height=5.875in,frame style={fill=yellow!50!white}]{% just for the background
%
\resizebox{4.5in}{5.875in}{\tcboxfit[blank,width=4.5in,fit height from=5in to 5.875in,fit basedim=20pt,fit fontsize macros]%
{\Huge This should fit in a 4.5in x 5.875in box but that is close to the left edge of paper, but it is not conforming to the box size desired....}}
%
}% just for the background
\end{document}