LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 08-09-2013, 03:43 AM   #1
aihaike
Member
 
Registered: Feb 2006
Location: Shanghai, China
Distribution: Slackware
Posts: 210

Rep: Reputation: 15
Question LibreOffice and code samples


Dear all,

I'm wondering whether there is a way to include code samples in a LibreOffice documents like the listings package in Latex.
Thanks,

Éric.
 
Old 08-09-2013, 06:52 PM   #2
timl
Member
 
Registered: Jan 2009
Location: Sydney, Australia
Distribution: Fedora,CentOS
Posts: 333

Rep: Reputation: 46
Hi, this one has been unanswered for a while and is pretty specific to LO. If you don't get an answer soon can I suggest a trip to http://nabble.documentfoundation.org...f1639495.html?

For the mailing lists you need to subscribe but I think you can post direct via the web interface
 
Old 08-10-2013, 12:35 AM   #3
John VV
Guru
 
Registered: Aug 2005
Posts: 13,481

Rep: Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803
Quote:
I'm wondering whether there is a way to include code samples in a LibreOffice documents
off hand i have no idea what it is you want

by "code samples" ???
do you mean something like this ?
Code:
#include "config.h" // GNU buildtools local configuration
#include "plugin-intl.h"  // i18n macros

#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

/* Shared with engine */
#include "imageFormat.h"
#include "map.h"
#include "engineParams.h"
#include "engine.h"

/* Shared with engine plugin. */
#include "resynth-constants.h"
#include "resynth-parameters.h"

/* Resynthesizer GUI gtk code: ask user for parameters. */
#include "resynth-gui.h"  


static void run(
  const gchar *     name,
  gint              nparams,  // !!! Always 3 for INTERACTIVE, not lengthof(param)?
	const GimpParam * param,
	gint *            nreturn_vals,
	GimpParam **      return_vals)
{
  static GimpParam values[1]; // return values persist after run() returns
  TGimpAdapterParameters parameters;
  gboolean ok;
  
  /* Unless anything goes wrong, result is success */
  *nreturn_vals = 1;
  *return_vals = values;
  values[0].type = GIMP_PDB_STATUS;
  values[0].data.d_status = GIMP_PDB_SUCCESS;

    /*  Initialize i18n support  */
#if defined(G_OS_WIN32)
  bindtextdomain (GETTEXT_PACKAGE, gimp_locale_directory());
#else
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#endif
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
  textdomain (GETTEXT_PACKAGE);
  
  /* Don't really need the drawable or its tiles until we get to the engine. */
  gint32 drawable_id;
  drawable_id = param[2].data.d_drawable;

the same way you would for any quote in Office

or are you referring to math functions
http://www.libreoffice.org/features/math/
http://ask.libreoffice.org/en/questi...a-formulamath/

Last edited by John VV; 08-10-2013 at 12:38 AM.
 
Old 08-10-2013, 12:31 PM   #4
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 3,221

Rep: Reputation: 823Reputation: 823Reputation: 823Reputation: 823Reputation: 823Reputation: 823Reputation: 823
The problem here seems to be that people like me who've worked with word processors for years haven't ever seen Latex, while Latex users probably don't use word processors! I looked up "listings package" but it left me none the wiser. Like John, I need to be told exactly what you're trying to do.
 
Old 08-11-2013, 06:30 PM   #5
aihaike
Member
 
Registered: Feb 2006
Location: Shanghai, China
Distribution: Slackware
Posts: 210

Original Poster
Rep: Reputation: 15
Thank you guys for your replying me.
Well, what I need to do is to include source code examples in my document (C, Fortran90, Python, Bash).
For each language you have a syntax highlighting, and I'm wondering whether LibreOffice as a macro for doing this.
I may have to create a "style" for each language but this would be painful.
Thanks,

Éric.
 
Old 08-11-2013, 07:50 PM   #6
John VV
Guru
 
Registered: Aug 2005
Posts: 13,481

Rep: Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803
Quote:
Well, what I need to do is to include source code examples in my document (C, Fortran90, Python, Bash).
For each language you have a syntax highlighting, and I'm wondering whether LibreOffice as a macro for doing this.
that might be a issue

each editor uses and can use different highlighting colors and bold
this can also be dependent on the OS theme and colors

-- the same "Gimp.h" file in Emacs,Kate,Kwrite

Last edited by John VV; 11-22-2014 at 03:53 PM.
 
Old 08-11-2013, 07:57 PM   #7
aihaike
Member
 
Registered: Feb 2006
Location: Shanghai, China
Distribution: Slackware
Posts: 210

Original Poster
Rep: Reputation: 15
Yes, this is definitely an issue.
I'm aware that different editor has different highlighting colors, but LibreOffice has not.
I'm going to make my own style ...
Thank you guys,

Éric.
 
Old 08-12-2013, 07:08 PM   #8
aihaike
Member
 
Registered: Feb 2006
Location: Shanghai, China
Distribution: Slackware
Posts: 210

Original Poster
Rep: Reputation: 15
Thumbs up

I finally got some hints.
One way to handle this is to generate a RTF file of the code using scite.
I also found this page very helpful : http://tohtml.com/
Just copy and past the preview to LibreOffice.
Best,

Éric.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
use code/script/CGI to load a LibreOffice document SaintDanBert Linux - Software 1 06-16-2013 09:49 PM
How to install only Writer from Libreoffice package"libreoffice-4.0.3-i486-1alien.txz just.srad Slackware 10 05-30-2013 03:37 PM
LXer: LibreOffice goes for “cleaner and leaner code base” with major update LXer Syndicated Linux News 2 02-08-2013 11:18 AM
LXer: This week at LWN: LPC: Michael Meeks on LibreOffice and code ownership LXer Syndicated Linux News 0 11-19-2010 04:30 PM
code for generating random samples! aru_04 Programming 2 07-21-2005 09:35 AM


All times are GMT -5. The time now is 07:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration