Marcelo Acuña wrote:
No, I have about 1000 of this ---comment---, and
I
need a global setting.
I think it is not possible to redefine --- without
changing the font metrics.
Thanks Jürgen, I posted the problem to
es.comp.lenguajes.tex and I get a solution
but this work in Kile and not work in Lyx.
Is not global but simple.
A person in that list say that
after put \usepackage[spanish]{babel}
in preamble I must put a tilde (~)
prev to em dash ~---like this---
In lyx this not work. Tilde is print without
any change but, before I re-quest to this
person I check it with Kile and this work very
well, tilde is not print and hyphenation is
made correctly.
How I can get it in Lyx?
You can get this in lyx by writing your em-dashes
as ERT. I.e. write the ~--- in ERT, and leave
the rest of the text normal.
I seem to remember you had lots of these?
You can fix them all this way:
Lyx can't do this with search and replace, but
a text editor capable of replacing several lines can
do it by working on the .lyx file.
0. Backup the .lyx file, in case the process goes
wrong.
1. Look at the lyx file, check what an ERT
containing
~--- looks like. My example is for lyx 1.4
2. Use a powerful text editor on the .lyx file, tell
it to replace every occurence of --- with:
\begin_inset ERT
status collapsed
\begin_layout Standard
~---
\end_layout
\end_inset
I.e.
aaa---bbb
should become
aaa
\begin_inset ERT
status collapsed
\begin_layout Standard
~---
\end_layout
\end_inset
bbb
Then all your em-dashes are hyphenation-free.
Open the latered file with lyx and verify that it is
ok, then view->dvi
To save work when writing:
Create one ~--- ERT, mark it and copy.
Whenever you need this construct, use paste.
Finally, setting up "babel" right should be as
simple
as setting the document language to spanish.
Helge Hafting
Helge, what good text editor ---in Linux--- can I to
use for this?
Many will do this, I just tested it with vim.
(If you haven't used vi-like editors such as vim,
be aware that they have two modes, and start up
in a modus where you can't actually type in text.
This is not really a problem, but confuses newbies.)
vim does search&replace when you type the command
:%s/text to search for/replacement text/g
In your case, you need linebreaks in the replacement
text. A linebreak is written as \r
i.e.
:%s/searchstring/two\rlines/g
will replace
searchstring
with
two
lines
The backslash is special, it is used to encode
things like linebreaks and other specials. In order to
use an actual backslash (for \begin) you type two
backslashes.
So make a backup copy of your lyx file, then do a
vim myfile.lyx
on the command line, to open the file.
Then type
:%s/---/\\begin_inset ERT\rstatus collapsed\r\r\\begin_layout
Standard\r\~---\r\\end_layout\r\r\\end_inset\r\r/g
Now that is an incredibly long line,
but don't worry about that. Just type it,
and press enter. (If your mailer broke the line,
take care to reconstruct it properly without missing
a possible space characters at the break.)
vim will hopefulle tell you that it did a lot of
replacements. Then save (write) and quit vim with the
command
:wq
Then try opening your file in lyx again, and try view->dvi.
This works for me (lyx 1.4.0). I get fewer breaks between
text and emdash, but those bad breaks aren't completely
eliminated. But then, I tried with 4 columns to get lots of
breaks. It was probably too narrow sometimes.
If it don't work - check that you entered the replace command
correctly. If this fails with some earlier version of lyx, just
make a test document containing ~--- in ERT and see how
your LyX stores that in the .lyx file.
Then modify the replacement command and try again.
Helge Hafting