문장을 번역할 수 있는 환경을 만들어주세요

문장을 번역할 수 있는 환경을 만들어주세요

언어를 번역해야 하거나 두 언어 모두에 예제를 만들어야 할 때 사용할 명령을 만들려고 합니다. 지금까지 각 언어별로 하나씩 텍스트와 두 개의 열 주위에 상자를 만들었습니다.

\newcommand{\biling}[3]{%
    \begin{tcolorbox}[colback=blue!10!white,boxrule=0pt]
        \begin{center}%
            \begin{minipage}{#3cm}%
                \flushright%
                #1%
            \end{minipage}\hspace{.5cm}%
            \begin{minipage}{#3cm}%
                \flushleft%
                #2%
            \end{minipage}%
        \end{center}%
    \end{tcolorbox}%
}

첫 번째 두 상자에서는 작동하지만 다음 장에서는 이미지에서 볼 수 있듯이 수직으로 잘못 정렬되어 있습니다.

텍스트가 세로로 잘못 정렬됨

전체 코드는 아래와 같습니다.

\documentclass[12pt,a4paper]{book}

\usepackage{geometry}
\geometry{hmargin = 2cm}

\usepackage{fontspec}

\usepackage{polyglossia}
    \setdefaultlanguage{english}
    \disablehyphenation

\usepackage{mathastext}

\def\dtch{\( \dot{H} \)}
\def\dth{\( \dot{h} \)}
\def\dtcm{\( \dot{M} \)}
\def\dtm{\( \dot{m} \)}
\def\dtcy{\( \dot{Y} \)}
\def\dty{\( \dot{y} \)}

\usepackage{tcolorbox}
\usepackage{xcolor}

\newcommand{\biling}[3]{%
    \begin{tcolorbox}[colback=blue!10!white,boxrule=0pt]
        \begin{center}%
            \begin{minipage}{#3cm}%
                \flushright%
                #1%
            \end{minipage}\hspace{.5cm}%
            \begin{minipage}{#3cm}%
                \flushleft%
                #2%
            \end{minipage}%
        \end{center}%
    \end{tcolorbox}%
}

\title{Comprehensive Guide To Þerysh}

\begin{document}    
    Starting with the basics we have the conjugation for the verb to be.

    \biling{I am \\
        You are \\
        He is \\
        She is \\
        It is \\
        We are \\
        You are \\
        They are}%
    %
        {À ty \\
        \dtcy\ ty \\
        Þi ty \\
        Þa ty \\
        Iss ty \\
        Jos ty \\
        Wos ty \\
        Ðè ty}
        {2}

    The conjugation of the verb to be is the same for every person. It's important to notice that you singular form is a different word from a you plural form. Let's take a look in some examples of sentences:

    \biling{
        F \dty\ kn \textcolor{red}{bohw} ess, \dty\ ty ðróss! \\
        \dtch, \dtm\ cwaþ \textcolor{red}{ty} Bjorn. \\
        Iss ty h lajr \textcolor{red}{ganyst} \dty. \\
        À \textcolor{red}{valtur} portugsh. \\
        Þa \textcolor{red}{almie} þi. \\
        Ðè \textcolor{red}{svo} h kr. \\
        Jos \textcolor{red}{fint} mísk.}%
    %
        {If you can \textcolor{red}{read} this, you're awesome! \\
        Hi, my name \textcolor{red}{is} Bjorn. \\
        It's a pleasure to \textcolor{red}{meet} you. \\
        I \textcolor{red}{speak} portuguese. \\
        She \textcolor{red}{loves} he. \\
        They \textcolor{red}{see} a car. \\
        We \textcolor{red}{listen} to music.}
        {7}

    \chapter{The Present Tense}

    To form the \textsc{present tense} one simply conjugates the verb in its primal form to all persons to express the idea of an action or something that is currently going on or habitually performed, or a state that currently or generally exists. If one wants to say that someone eats, the verb to be conjugated is \textit{ctom}.

    \biling{À ctom \\
        \dtcy\ ctom \\
        Þi ctom \\
        Þa ctom \\
        Iss ctom \\
        Jos ctom \\
        Wos ctom \\
        Ðè ctom}%
    %
        {I eat \\
        You eat \\
        He eats \\
        She eats \\
        It eats \\
        We eat \\
        You eat \\
        They eat}%
    {3}

\end{document}

어떻게 정렬하나요? 이미 그렇게 하는 패키지나 명령, 환경이 있나요? LuaLaTeX로 컴파일 중입니다.

답변1

[t]당신의 정렬을 사용하십시오 minipage.

\documentclass[12pt,a4paper]{book}

\usepackage{geometry}
\geometry{hmargin = 2cm}

\usepackage{fontspec}

\usepackage{polyglossia}
    \setdefaultlanguage{english}
    \disablehyphenation

\usepackage{mathastext}

\def\dtch{\( \dot{H} \)}
\def\dth{\( \dot{h} \)}
\def\dtcm{\( \dot{M} \)}
\def\dtm{\( \dot{m} \)}
\def\dtcy{\( \dot{Y} \)}
\def\dty{\( \dot{y} \)}

\usepackage{tcolorbox}
\usepackage{xcolor}

\newcommand{\biling}[3]{%
    \begin{tcolorbox}[colback=blue!10!white,boxrule=0pt]
        \begin{center}%
            \begin{minipage}[t]{#3cm}%
                \flushright%
                #1%
            \end{minipage}\hspace{.5cm}%
            \begin{minipage}[t]{#3cm}%
                \flushleft%
                #2%
            \end{minipage}%
        \end{center}%
    \end{tcolorbox}%
}

\title{Comprehensive Guide To Þerysh}

\begin{document}    
    Starting with the basics we have the conjugation for the verb to be.

    \biling{I am \\
        You are \\
        He is \\
        She is \\
        It is \\
        We are \\
        You are \\
        They are}%
    %
        {À ty \\
        \dtcy\ ty \\
        Þi ty \\
        Þa ty \\
        Iss ty \\
        Jos ty \\
        Wos ty \\
        Ðè ty}
        {2}

    The conjugation of the verb to be is the same for every person. It's important to notice that you singular form is a different word from a you plural form. Let's take a look in some examples of sentences:

    \biling{
        F \dty\ kn \textcolor{red}{bohw} ess, \dty\ ty ðróss! \\
        \dtch, \dtm\ cwaþ \textcolor{red}{ty} Bjorn. \\
        Iss ty h lajr \textcolor{red}{ganyst} \dty. \\
        À \textcolor{red}{valtur} portugsh. \\
        Þa \textcolor{red}{almie} þi. \\
        Ðè \textcolor{red}{svo} h kr. \\
        Jos \textcolor{red}{fint} mísk.}%
    %
        {If you can \textcolor{red}{read} this, you're awesome! \\
        Hi, my name \textcolor{red}{is} Bjorn. \\
        It's a pleasure to \textcolor{red}{meet} you. \\
        I \textcolor{red}{speak} portuguese. \\
        She \textcolor{red}{loves} he. \\
        They \textcolor{red}{see} a car. \\
        We \textcolor{red}{listen} to music.}
        {7}

    \chapter{The Present Tense}

    To form the \textsc{present tense} one simply conjugates the verb in its primal form to all persons to express the idea of an action or something that is currently going on or habitually performed, or a state that currently or generally exists. If one wants to say that someone eats, the verb to be conjugated is \textit{ctom}.

    \biling{À ctom \\
        \dtcy\ ctom \\
        Þi ctom \\
        Þa ctom \\
        Iss ctom \\
        Jos ctom \\
        Wos ctom \\
        Ðè ctom}%
    %
        {I eat \\
        You eat \\
        He eats \\
        She eats \\
        It eats \\
        We eat \\
        You eat \\
        They eat}%
    {3}

\end{document}

여기에 이미지 설명을 입력하세요

기본(가운데) 정렬을 사용하면 원하지 않는 텍스트 이동이 발생합니다.

여기에 이미지 설명을 입력하세요

답변2

패키지를 사용하는 경우 s tcolorbox가 필요하지 않을 수 있으며 세 개의 인수로 명령을 minipage정의하는 대신\biling\newtcolorbox{biling}{...}

\documentclass[12pt,a4paper]{book}

\usepackage{geometry}
\geometry{hmargin = 2cm}

\usepackage{fontspec}

\usepackage{polyglossia}
    \setdefaultlanguage{english}
    \disablehyphenation

\usepackage{mathastext}

\def\dtch{\( \dot{H} \)}
\def\dth{\( \dot{h} \)}
\def\dtcm{\( \dot{M} \)}
\def\dtm{\( \dot{m} \)}
\def\dtcy{\( \dot{Y} \)}
\def\dty{\( \dot{y} \)}

\usepackage{tcolorbox}
%\usepackage{xcolor}

\newtcolorbox{bilingbox}{colback=blue!10!white,
                          frame empty,
                          segmentation empty,
                          halign=flush right,
                          sidebyside,
                          sidebyside gap=5mm,
                          sidebyside align=top
                          }

% \newcommand{\biling}[3]{%
%     \begin{tcolorbox}[colback=blue!10!white,boxrule=0pt]
%         \begin{center}%
%             \begin{minipage}{#3cm}%
%                 \flushright%
%                 #1%
%             \end{minipage}\hspace{.5cm}%
%             \begin{minipage}{#3cm}%
%                 \flushleft%
%                 #2%
%             \end{minipage}%
%         \end{center}%
%     \end{tcolorbox}%
% }

\title{Comprehensive Guide To Þerysh}

\begin{document}    
    Starting with the basics we have the conjugation for the verb to be.

    \begin{bilingbox}
    I am \\
        You are \\
        He is \\
        She is \\
        It is \\
        We are \\
        You are \\
        They are
        \tcblower
        À ty \\
        \dtcy\ ty \\
        Þi ty \\
        Þa ty \\
        Iss ty \\
        Jos ty \\
        Wos ty \\
        Ðè ty

    \end{bilingbox}

    % \biling{I am \\
    %     You are \\
    %     He is \\
    %     She is \\
    %     It is \\
    %     We are \\
    %     You are \\
    %     They are}%
    % %
    %     {À ty \\
    %     \dtcy\ ty \\
    %     Þi ty \\
    %     Þa ty \\
    %     Iss ty \\
    %     Jos ty \\
    %     Wos ty \\
    %     Ðè ty}
    %     {2}

    The conjugation of the verb to be is the same for every person. It's important to notice that you singular form is a different word from a you plural form. Let's take a look in some examples of sentences:

    \begin{bilingbox}
     F \dty\ kn \textcolor{red}{bohw} ess, \dty\ ty ðróss! \\
        \dtch, \dtm\ cwaþ \textcolor{red}{ty} Bjorn. \\
        Iss ty h lajr \textcolor{red}{ganyst} \dty. \\
        À \textcolor{red}{valtur} portugsh. \\
        Þa \textcolor{red}{almie} þi. \\
        Ðè \textcolor{red}{svo} h kr. \\
        Jos \textcolor{red}{fint} mísk.

        \tcblower
    If you can \textcolor{red}{read} this, you're awesome! \\
        Hi, my name \textcolor{red}{is} Bjorn. \\
        It's a pleasure to \textcolor{red}{meet} you. \\
        I \textcolor{red}{speak} portuguese. \\
        She \textcolor{red}{loves} he. \\
        They \textcolor{red}{see} a car. \\
        We \textcolor{red}{listen} to music.
    \end{bilingbox}

    % \biling{
    %     F \dty\ kn \textcolor{red}{bohw} ess, \dty\ ty ðróss! \\
    %     \dtch, \dtm\ cwaþ \textcolor{red}{ty} Bjorn. \\
    %     Iss ty h lajr \textcolor{red}{ganyst} \dty. \\
    %     À \textcolor{red}{valtur} portugsh. \\
    %     Þa \textcolor{red}{almie} þi. \\
    %     Ðè \textcolor{red}{svo} h kr. \\
    %     Jos \textcolor{red}{fint} mísk.}%
    % %
    %     {If you can \textcolor{red}{read} this, you're awesome! \\
    %     Hi, my name \textcolor{red}{is} Bjorn. \\
    %     It's a pleasure to \textcolor{red}{meet} you. \\
    %     I \textcolor{red}{speak} portuguese. \\
    %     She \textcolor{red}{loves} he. \\
    %     They \textcolor{red}{see} a car. \\
    %     We \textcolor{red}{listen} to music.}
    %     {7}

    \chapter{The Present Tense}

    To form the \textsc{present tense} one simply conjugates the verb in its primal form to all persons to express the idea of an action or something that is currently going on or habitually performed, or a state that currently or generally exists. If one wants to say that someone eats, the verb to be conjugated is \textit{ctom}.

    \begin{bilingbox}
    À ctom \\
        \dtcy\ ctom \\
        Þi ctom \\
        Þa ctom \\
        Iss ctom \\
        Jos ctom \\
        Wos ctom \\
        Ðè ctom

        \tcblower
        I eat \\
        You eat \\
        He eats \\
        She eats \\
        It eats \\
        We eat \\
        You eat \\
        They eat

    \end{bilingbox}

    % \biling{À ctom \\
    %     \dtcy\ ctom \\
    %     Þi ctom \\
    %     Þa ctom \\
    %     Iss ctom \\
    %     Jos ctom \\
    %     Wos ctom \\
    %     Ðè ctom}%
    % %
    %     {I eat \\
    %     You eat \\
    %     He eats \\
    %     She eats \\
    %     It eats \\
    %     We eat \\
    %     You eat \\
    %     They eat}%
    % {3}

\end{document}

관련 정보