eso-pic
패키지를 사용하여 왼쪽 상단 모서리를 기준으로 각 페이지에 콘텐츠를 배치하는 문서 클래스를 만들었습니다 . 이제 나는 (일부) 히브리어 문서에서 이 문서 클래스를 사용했습니다. 히브리어의 경우 패키지를 사용하고 있습니다 polyglossia
.이 게시물XeLaTeX와 함께하세요. 페이지 레이아웃을 오른쪽에서 왼쪽으로 전환하는 데 사용 polyglossia
됩니다 .bidi
왼쪽 상단의 위치를 제외하고는 모든 것이 잘 작동합니다. 다음 예는 내 문제를 보여줍니다.
\documentclass{article}
% set font for hebrew
\usepackage{fontspec}
\setmainfont{DejaVuSans.ttf}
% if polyglossia is commented
\providecommand{\setLTR}{}
\providecommand{\setRTL}{}
% write "test" a few times
\newcounter{loopcounter}
\newcommand{\writetest}{
\loop
\ifnum\value{loopcounter}<36
Test\theloopcounter
\stepcounter{loopcounter}
\repeat
}
% add the test in the top left corner
\usepackage{calc}
\usepackage{picture}
\usepackage{eso-pic}
\AddToShipoutPictureFG{
\AtPageUpperLeft{%
% see the bottom of the question for the \put()
\put(0,0){
\raisebox{-\height-3pt}{
% needed to do left to right align and for breaking
\parbox{\paperwidth}{
\setLTR
\writetest
}
}
}
}
}
\usepackage{polyglossia} % <- If those packages are commented the placing
\setmainlanguage{hebrew} % <- of the top left content is correct.
\begin{document}
תוכן
\end{document}
주어진 예제를 컴파일하면 다음 그림 하단에 결과가 표시됩니다. 하지만 왼쪽 상단에 있는 콘텐츠는 왼쪽 상단에 있지 않습니다.
두 번째 위 그림은 완전히 동일한 예이지만 the \usepackage{polyglossia}
와 the가 \setmainlanguage{hebrew}
주석 처리되어 있습니다. 따라서 bidi
패키지가 로드되지 않습니다. 코너 텍스트가 정확합니다. 그러나 이제 히브리어 본문은 (물론) 오른쪽에서 왼쪽으로 되어 있지 않습니다.
제공된 코드에서 볼 수 있듯이 오프셋을 수정하기 위해 이미 \put()
(패키지와 함께 ) 사용을 시도했습니다. picture
그러나 나는 그것이 무엇인지 알 수 없습니다. 그것은 다음과 같아야 합니다 -\textwidth-\marginright
. 하지만 그렇지 않습니다.
\AddToShipoutPictureFG
문서 클래스에 있습니다 . 콘텐츠와 동일한 파일에 있지 않습니다. 다양한 파일에서 문서 클래스를 사용하고 싶기 때문에 크기가 변경됩니다. 페이지 크기와 관련된 오프셋을 알아야 합니다. 절대값이 아닙니다. 사용해도 put(-11.872cm, 0)
문제가 해결되지 않습니다.
왼쪽 상단에 콘텐츠를 배치하고 어떻게 polyglossia
함께 사용할 수 있나요 ?eso-pic
답변1
원하는 것은 아니지만 다음은 패키지를 사용하여 쉽게 구현할 수 있는 솔루션 background
입니다 tikz
.
\documentclass[letterpaper]{article}
% set font for hebrew
\usepackage{fontspec}
\setmainfont{DejaVuSans.ttf}
% write "test" a few times
\newcounter{loopcounter}
\newcommand{\writetest}{
\loop
\ifnum\value{loopcounter}<36
Test\theloopcounter
\stepcounter{loopcounter}
\repeat
}
% add the test in the top left corner
\usepackage[all]{background}
\backgroundsetup{%
placement = top,
color = black,
opacity=1,
scale = 1,
vshift=-6pt,
contents = {%
\tikz \node [text width=\paperwidth-12pt, align=justify] {\writetest};
},
}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\begin{document}
תוכן
\end{document}