Hossein Noorikhah wrote:

> Hi
> By default, when I want to use an alternative language beside English, I
> can seperate it in the commands needed to switch to that language, ... .
> But now my problem is that I want to use an arabic context(really
> persian, that has somehow similar script to arabic), and I want to
> seperate English text in my desired tags, when the actual TeX code is
> generated. Even when I set my default language to arabic in LyX, I could
> not reach to that goal. Could you please tell me how to do this? Or how I
> can do something that has the same functionality?
> 
> For example I want to reach this after the TeX code is generated:
> (ARABIC-TEXT is some kind of arabic text, and ENGLISH-TEXT is english
> text)
> 
> 
> ARABIC-TEXT ARABIC-TEXT ARABIC-TEXT
> ....
> {\englishtext ENGLISH-TEXT ENGLISH-TEXT}
> ...
> ARABIC-TEXT ARABIC-TEXT ARABIC-TEXT
> ...
Hi, Hossein.

I take it that you have already enabled "Right-to-left language support" 
in the "Language Settings->Language" pane of the "Edit->Preferences" 
dialog?

If I export the attached lyx document to latex (File->Export->LaTeX) I see:

\documentclass[arabic,english]{article}
\usepackage[T1]{fontenc}
\usepackage[unknown,latin1]{inputenc}

\makeatletter
\usepackage{babel}
\makeatother
\begin{document}
\selectlanguage{arabic}
\inputencoding{unknown}
ARABIC TEXT ARABIC TEXT ARABIC TEXT \L{ENGLISH TEXT ENGLISH TEXT ENGLISH
TEXT ENGLISH TEXT} ARABIC TEXT ARABIC TEXT ARABIC TEXT.
\selectlanguage{english}
\end{document}

The '\selectlanguage{LANG}' bit can be specified in the Edit->Preferences 
dialog. The '\L{...}' bit appears to be hard-coded inside LyX.

I suspect that you'll need to post-process this to attain your desired 
output.

If all you need is to replace '\L{' with '{\englishtext' then I'd suggest 
that you should write a little wrapper script

#! /bin/sh

# A wrapper script to invoke the LaTeX compiler,
# first transforming the data, replacing all '\L{' with '{\englishtext'

sed 's/\\L{/{\\englishtext/g' "$1" > "$1.$$"
mv -f "$1.$$" "$1"

latex "$1"
# The end

You should redefine your latex -> dvi converter (see the  converters pane 
in the Edit->Preferences dialog) to use this script. Something like:

    From:       LaTeX
    To:         DVI
    Converter:  my_latex $$i
    Extra Flag  latex

Press "Modify" and then "Save"


If that's not enough, then feel free to come back ;)

-- 
Angus
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Standard


\lang arabic
ARABIC TEXT ARABIC TEXT ARABIC TEXT
\lang english
 ENGLISH TEXT ENGLISH TEXT ENGLISH TEXT ENGLISH TEXT
\lang arabic
 ARABIC TEXT ARABIC TEXT ARABIC TEXT.
\the_end

Reply via email to