Erstellen Sie eine Umgebung zum Übersetzen von Sätzen

Erstellen Sie eine Umgebung zum Übersetzen von Sätzen

Ich versuche, einen Befehl zu erstellen, der verwendet werden kann, wenn ich die Sprache übersetzen oder Beispiele für beide Sprachen erstellen muss. Bisher habe ich ein Feld um den Text und zwei Spalten erstellt, eine für jede Sprache.

\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}%
}

In den ersten beiden Feldern funktioniert es, aber im folgenden Kapitel ist es vertikal falsch ausgerichtet, wie Sie im Bild sehen können:

Text vertikal falsch ausgerichtet

Der gesamte Code wird unten angezeigt:

\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}

Wie richte ich es aus? Gibt es ein Paket, einen Befehl oder eine Umgebung, die das bereits macht? Ich kompiliere es mit LuaLaTeX.

Antwort1

Verwenden Sie [t]die Ausrichtung auf Ihren minipageS.

\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}

Bildbeschreibung hier eingeben

Bei der Standardausrichtung (zentriert) kommt es zu einer unerwünschten Textverschiebung:

Bildbeschreibung hier eingeben

Antwort2

Wenn Sie das tcolorboxPaket verwenden, benötigen Sie möglicherweise die minipages nicht und definieren den \bilingBefehl nicht mit drei Argumenten, sondern definieren ein\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}

verwandte Informationen