On 22.10.2008, at 14:12, Charles de Miramon wrote:
Daniel Lohmann wrote:
[...]
occurrences with some ERT box is not an option, as this would cause
too much hassle and would not work in external material, such as
bibliographic entries. I am looking for a more elegant solution.
The easiest way would be to process your latex and bib files through
a sed
script to replace C++ to \C++ and define a \C++ macro with the correct
space between C and +
Thanks Charles!
However, I am editing and working in LyX, not LaTeX. Replacing C++ in
the lyx files by the correct ERT boxes is somewhat more complicated,
as it requires inserting some extra begin_inset and end_inset lines.
Moreover, this would not cover the occurrences of C++ in the
bibliography.
I think that I remember to have read about so-called catcodes (or
whatever?) in TeX, which apparently make it possible to declare
certain characters as "active" so that further processing is possible
whenever the TeX scanner reads such character. I wonder if it is
possible this way to declare in the preamble that
"C" followed by "+", followed by "+"
is "active" and should be inherently substituted with something like
"\mbox{C+\hspace{-.5ex}+}}"
It is possible to redefine in TeX the letter C catcode and then test
if it
is followed by two +. But it is a lot of work (TeX macros are not very
easy) and maybe it is like using a hammer to kill a fly.
Well, I really do like hammers! :-)
Daniel