General ⇒ \newcommand in \input'ed file?
-
- Posts: 8
- Joined: Fri Feb 18, 2011 9:50 pm
\newcommand in \input'ed file?
if there any possibility to make it working? I making various docs and I would like
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: \newcommand in \input'ed file?
it's possible. It's even the expected behavior. They won't be seen if they are defined within a group or environment. Just show example code, what you are doing which doesn't work.
Stefan
-
- Posts: 8
- Joined: Fri Feb 18, 2011 9:50 pm
Re: \newcommand in \input'ed file?
I feel so dumb...
The problem was in encoding, the preamble was encoded differently, and I had these extra characters in \newcommand

It was so hard to figure for me...I using Lyx 1.6 and it giving very little debug options.
I tried to reproduce it in texMaker and, it worked just fine (since for texmaker both preamble and master were in same encoding as I made them from scratch) and after reading your post that it supposed to be working, and my texmaker experience.. I got a clue of what the hell happening

Edit: yes, the problem was with encoding, by some strange reason Lyx default encoding for Cyrillic is KOI8-R and not UTF-8, so I had my main master file in KOI8-R and tried to \input UTF-8 preamble, which caused some strange errors, nature of which I just couldn't get, because I just made couple of copy/paste...
Now everything works as supposed.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
\newcommand in \input'ed file?
Then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to be read before posting).mike-klemin wrote:[…] Now everything works as supposed. […]
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10