Menu
+

About Get Support

Results for category "Uncategorized"

16 Articles

Vim + LaTeX and YOU!

Author’s note: I think I can make this one short.

Let’s start with a preview sure to make a reader envious with desire to to actually read forward.

Notice how we’re still in insert mode and that this file hasn’t been saved yet. For some, this is all they want, the ability to have a live preview rendering of their drawing. To receive that WYSIWYG culture intersected with the WYSIWYM dogma which is life. That’s what  the kids want these days. I didn’t write this, it’s simply yet another plug-in for vim. What I will go over, is how this tool in combination with a few little hacks helps to streamline report making.

Okay, the secret sauce is in the makefile.

TARGET=filename                                                                  
PDFVIEWER=evince                                                                

all: $(TARGET).pdf                                                              

## Generalized rule: how to build a .pdf from each .tex                         
LATEXPDFS=$(patsubst %.tex,%.pdf,$(wildcard *.tex))                             
$(LATEXPDFS): %.pdf: %.tex                                                      
     pdflatex -interaction nonstopmode $(patsubst %.pdf,%.tex,$@)                

# removes intermediate files                                                    
clean:                                                                          
     rm *.aux *.log || true                                                      

# removes intermediate files AND the .pdf you made                             
veryclean: clean                                                                
     rm $(TARGET).pdf                                                            

# compiles file and uses evince to view document, or use your favorite viewer!  
view: $(TARGET).pdf                                                             
      $(PDFVIEWER) $(TARGET).pdf                                                  

# in case you're working in a sub-folder and need to send elsewhere             
submit: $(TARGET).pdf                                                           
    cp $(TARGET).pdf ../                                                        
                                                                                 
# lpr will use default printer and default printer settings                     
print: $(TARGET).pdf                                                            
     lpr $(TARGET).pdf                                                           

 .PHONY: all clean veryclean view print

For yourself, the “filename” variable should be changed to your filename without the extension. So if your filename is “myFinalReport002.tex” the first line should read “TARGET=myFinalReport002”. PDFVIEWER should be set to whichever pdfviewer you prefer on your machine. Evince is the one used here.

mkdir a  folder for your latex report. In this folder, you’ll want both this makefile and the myFinalReport002.tex that you’re working on. The sample *.tex file in the screen shot above is simply this

% This is a sample input file
% & $ # % _ { } ^ ~ \ are all special characters

\documentclass{article}
\begin{document}

\section{Simple Text}

Words are separated by one or more spaces.  Paragraphs are separated by
one or more blank lines.  The output is not affected by adding extra
spaces or extra blank lines to the input file.

Double quotes are typed like this: ``quoted text''.
Single quotes are typed like this: `single-quoted text'.

Long dashes are typed as three dash characters---like this.

Emphasized text is typed like this: \emph{this is emphasized}.

Bold       text is typed like this: \textbf{this is bold}

\subsection{A warning or Two}
If you get more space after a mid-sentence period---abbreviations
like etc.\ are common culprits---then type a backslash followed by
a space after the period, as in this sentence.

Remember, don't type the 10 special characters (such as dollar sign and
backslash) except as directed!  The following seven are printed by
typing a backslash in front of them: \$ \& \# \% \_ \{ \}.
The manual tells how to make other symbols.

Greetings people who read my blog! o/

\end{document}

With these two files in your working directory you can simply call make, make clean, make veryclean, make submit, make view, and finally makelpr (for when you want to print and are on the go). A person can pretty much put whatever commands they want to inside the makefile, but here’s something neat about using vim with the makefile.

:make view

Just as you normally would :w or :wq,  vim has an inbuilt function where it runs commands inside of a makefile that’s in the same directory. There’s no need to open up a 2nd terminal screen or to exit vim to check you work (or submit the report). If typing in :make view is too much for you, you can always remap the commands in your .vimrc like so

155 " LaTeX fun - in lou of :make view                                              
156 command MV w | make view                                                                                                                                                                    
157                                                                                 
158 " LivePreview                                                                   
159 let LLPSTartPreview = "VLP"

If typing :mv becomes too much for you, and constantly checking and rechecking your work puts a strain on your body, mind, and soul; then there’s a way to make this viewing thing a bit more automated. Aforementioned, there’s a plugin.

cd into your ~/.vim/bundle and simply

git clone https://github.com/xuhdev/vim-latex-live-preview

To begin, all you need to do is invoke :LLPSTartPreview in your vim terminal, but adjust that .vimrc for a more pleasant experience. The READ.md instructions for this plugin does not explicitly mention pathogen(), but /bundle is the defacto /plugin folder. These quick instructions should get most people started, but for this plugin to work you’ll need to make sure that your vim has been compiled with a specific configuration, e.g. python. Most vim installs on a new system are meant to be light weight, and quick to load. If you’re having issues while compiling your own heavy duty vim installation you might find this post helpful.

Terms & Conditions

These Terms and Conditions act as a contractual agreement (“Agreement”) between you and Julio B. Figueroa, aoreugif the longest journey – a story about a guy (“I”, “me”, “aoreugif”, “us”, “we”, “our”), and applies to your use of  www.aoreugif.net. (“Site”). If you do not agree to be bound by the terms of this Agreement as detailed herein, please do not use or access the website. YOU REPRESENT THAT YOU ARE AT LEAST 18 YEARS OLD AND LEGALLY COMPETENT TO ENTER INTO THIS AGREEMENT.

1. PRIVACY POLICY. We respect your privacy. A complete statement of our current privacy policy can be found by clicking here. The privacy policy is expressly incorporated into this Agreement by reference.

2. LICENSE. We grant you a non-exclusive, non-sublicensable, non-transferable license and right to use and access the Site. You understand and agree you have no right to modify, edit, create derivative works from, distribute, sell, rent, share, or republish any information provided on the Site or publications provided through the Site without our express consent. You further understand no ownership right in the content on this Site or publications being provided through it is being granted to you.

3. ORIGINAL PRODUCTS. We offer original products we’ve created through the Site. You hereby authorize us and our payment processor to charge your payment source in advance of the delivery of an original product of your choice for all applicable fees incurred by you or on your behalf in connection with that product. If payment cannot be obtained from the payment resource you provide or the charge is returned for any reason, your rights to access the product in question shall be void.

4. REFUNDS. aoreugif offers a 90-day refund period on any original products you purchase through the Site. Contact us to request a refund.

5. VIOLATIONS. If you materially breach any term of this Agreement, we may, in our sole discretion, terminate your access to the Site. We reserve the right to seek all remedies available by law and in equity for such breaches.

6. GOVERNING LAW AND VENUE. This Agreement shall be construed in accordance with and governed by the laws of Nevada and the United States without reference to their rules regarding conflicts of law. However, you hereby irrevocably consent to the exclusive jurisdiction and venue of the courts in Las Vegas, Nevada in all disputes arising out of or related to the use of the Site.

7. COMMUNICATION. When you contact us or sign up to receive our newsletter, you consent to receive communications from us electronically. You agree that any such communication via email shall constitute proper written communication in compliance with any and all legal notice requirements.

8. USER CONTENT. By posting, uploading, displaying, performing, transmitting, or otherwise distributing information or other content (“User Content”) to the Site, you grant aoreugif, its affiliates, officers, directors, employees, consultants, agents, and representatives a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to use the User Content in connection with the Internet business of aoreugif, its affiliates, officers, directors, employees, consultants, agents, and representatives, including without limitation, a right to copy, distribute, transmit, publicly display, publicly perform, reproduce, edit, translate, and reformat User Content. You will not be compensated for any User Content. By posting User Content on the Site, you warrant and represent that you own the rights to the User Content or are otherwise authorized to post, distribute, display, perform, transmit, or otherwise distribute User Content.

9. NO WARRANTIES. AOREUGIF HEREBY DISCLAIMS ALL WARRANTIES. WE ARE MAKING THE SITE AVAILABLE “AS IS” WITHOUT WARRANTY OF ANY KIND. YOU ASSUME THE RISK OF ANY AND ALL DAMAGE OR LOSS FROM USE OF, OR INABILITY TO USE, THE SITE. TO THE MAXIMUM EXTENT PERMITTED BY LAW, WE EXPRESSLY DISCLAIM ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE SITE, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. AOREUGIF DOES NOT WARRANT THAT THE SITE OR CONTENT OFFERED THROUGH THE SITE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION OF THE SITE WILL BE UNINTERRUPTED OR ERROR-FREE.

10. LIMITED LIABILITY. AOREUGIF DISCLAIMS ANY AND ALL LIABILITY (WHETHER BASED IN CONTRACT, TORT, STRICT LIABILITY, BREACH OF WARRANTY, OR OTHERWISE) FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES ARISING OUT OF OR IN ANY WAY CONNECTED WITH ACCESS TO OR USE OF THE SITE OR THIS AGREEMENT. AOREUGIF ’S MAXIMUM LIABILITY ARISING OUT OF OR IN CONNECTION WITH YOUR USE OF THIS SITE, REGARDLESS OF THE CAUSE OF ACTION, WILL NOT EXCEED $1 SHOULD YOU BE DECLARED THE PREVAILING PARTY IN A CLAIM AGAINST US

11. EXCLUSIONS AND LIMITATIONS. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS OF SECTIONS 9 AND 10 MAY NOT APPLY TO YOU.

12. SITE TERMINATION. We reserve the right to no longer make available all or part of the Site at any time in our sole discretion.

13. COMPLIANCE WITH INTELLECTUAL PROPERTY LAWS. When accessing the Site, you agree to obey the law and to respect the intellectual property rights of others. Your use of the Site is at all times governed by and subject to laws regarding copyright ownership and use of intellectual property. You agree not to upload, download, display, perform, transmit, or otherwise distribute any information or content (collectively, “Content”) in violation of any third party’s copyrights, trademarks, or other intellectual property or proprietary rights. You agree to abide by laws regarding copyright ownership and use of intellectual property, and you shall be solely responsible for any violations of any relevant laws and for any infringements of third party rights caused by any Content you provide or transmit. The burden of proving that any Content does not violate any laws or third party rights rests solely with you.

14. AFFILIATED SITES. Aoreugif has no control over and assumes no liability for any third party websites or materials. Aoreugif works with a number of partners and affiliates whose Internet sites may be linked within the Site. Because aoreugif has no control over the content and performance of these partner and affiliate sites, aoreugif makes no guarantees about the accuracy, currency, content, or quality of the information provided by such sites, and aoreugif assumes no responsibility for unintended, objectionable, inaccurate, misleading, or unlawful content that may reside on those sites. Similarly, from time to time in connection with your use of the Site, you may have access to content items (including, but not limited to, websites) owned by third parties. You acknowledge and agree that aoreugif makes no guarantees about, and assumes no responsibility for, the accuracy, currency, content, or quality of this third party content, and, unless expressly provided otherwise, these Terms and Conditions shall govern your use of any and all third party content.

15. PROHIBITED USES. Aoreugif imposes certain restrictions on your permissible use of the Site. You are prohibited from violating or attempting to violate any security features of the Site, including, without limitation, (a) accessing content or data not intended for you, or logging onto a server or account that you are not authorized to access; (b) attempting to probe, scan, or test the vulnerability of the Site, or any associated system or network, or to breach security or authentication measures without proper authorization; (c) interfering or attempting to interfere with service to any user, host, or network, including, without limitation, by means of submitting a virus to the Site , overloading, “flooding,” “spamming,” “mail bombing,” or “crashing;” (d) forging any TCP/IP packet header or any part of the header information in any e-mail or in any posting using the Service; (e) attempting to modify, reverse-engineer, decompile, disassemble, or otherwise reduce or attempt to reduce to a human-perceivable form any of the source code used by aoreugif; or (f) automatically or manually scraping or copying the content from the Site without our consent. Any violation may subject you to civil and/or criminal liability.

16. INDEMNITY. You agree to indemnify, defend, and hold harmless aoreugif, its affiliates, officers, directors, employees, consultants, agents, and representatives from any and all third party claims, losses, liability, damages, and/or costs (including reasonable attorney fees and costs) arising from your access to or use of the Site, your violation of these Terms and Conditions, or your infringement, of any intellectual property or other right of any person or entity. Aoreugif will notify you promptly of any such claim, loss, liability, or demand, and will provide you with reasonable assistance, at your expense, in defending any such claim, loss, liability, damage, or cost.

17. COPYRIGHT. All contents, excluding user generated content, Copyright 2018 Julio B. Figueroa. All rights reserved.

18. SEVERABILITY; WAIVER. If a court of competent jurisdiction finds any term or condition in this Agreement to be unenforceable or null, all other terms will remain unaffected and in full force and effect. No waiver of any breach of any provision of this Agreement shall constitute a waiver of any prior, concurrent, or subsequent breach of the same or any other provisions hereof, and no waiver shall be effective unless made in writing and signed by an authorized representative of the waiving party.

19. NO LICENSE. Nothing contained on the Site should be understood as granting you a license to use any of the trademarks, service marks, or logos of aoreugif or any third party.

20. MODIFICATIONS. Aoreugif may, in its sole discretion, modify or amend this Agreement at any time. Aoreugif shall post notice of any such changes on the Site and shall email you notice of such changes if we have an email address for you. Your decision to continue to use the Site upon such notice shall constitute your acceptance of any amendments to this document. You may choose to reject the amendments by terminating your use of the Site.

Please contact us if you have any questions regarding these Terms and Conditions.

Live Updates: Post Numbered as #2 4/12/17

Okay so,

I don’t remember falling asleep. I just did. I fumbled around with my set up on one of the test scripts and had 3 ideas I was going to try. First, I copied it wrong, and I was going to read the comments to check for anything I might’ve missed. 2nd, the make check command on the top level directory went through all the demos and got a passing score. So, have a look at the make check portion of that Makefile to see how the developers are doing it (but that’s for the shell script and not the magick++ portion?). Finally 3rd, I already forgot what the 3rd route was in my head. I played around with the first one a bit and after 10minutes it worked. I don’t like it though. I’m using that “helpful” Magick++-config shell script the developers included with the backquotes in my command line. I’m not used to doing this. Anyways, the test code makes a c++ program that if you run it creates a logo.png file. Now, I’m working on a make file that incorporates the Magick++-config shell script. This means that the shell script needs to be in the directory I’m working on or linked to in the PATH. Again, this feels like an extra step. Traditionally I would have a list of all the flags my program needs and then just hardwire those into my Makefile. The script seems to work for now though. Below is the raw test code that I’m running. Shamelessly copy and pasted.

#include <Magick++.h> 
#include <iostream> 

using namespace std; 
using namespace Magick; 

int main(int argc,char **argv) 
{ 
  InitializeMagick(*argv);

  // Construct the image object. Seperating image construction from the 
  // the read operation ensures that a failure to read the image file 
  // doesn't render the image object useless. 
  Image image;
  try { 
    // Read a file into image object 
    image.read( "logo:" );

    // Crop the image to specified size (width, height, xOffset, yOffset)
    image.crop( Geometry(100,100, 100, 100) );

    // Write the image to a file 
    image.write( "logo.png" ); 
  } 
  catch( Exception &error_ ) 
    { 
      cout << "Caught exception: " << error_.what() << endl; 
      return 1; 
    } 
  return 0; 
}

To get it to run, you need this in its own directory, alongside with the executable shell script Magick++-config. If it’s not executable use that chmod magic. Then just vim Makefile what I wrote below

CC = g++ 
FLAGS = `Magick++-config --cppflags --cxxflags --ldflags --libs` 
 
all: 
  $(CC) $(FLAGS) -o resoScript.exe resoScript.cpp 
  
clean: 
  rm *.png *.exe

my cpp compile is g++, change it to your own. To run this bad boy simply invoke make. then run ./resoScript.exe to run the newly created executable and it will create the logo.png file. To restart everything, just invoke make clean and the rm commands you see above will delete the 2 files all in one go. Generically speaking, any filename that ends in .png or .exe inside the directory will be targeted. With this, you can make changes to resoScript.cpp and destroy what you make quickly and go back and forth without having to do a lot of typing. If you keep a separate window opened to the directory on your multi-screen terminal, just press the up arrow to go back to the previous command. This make files assume that your renamed the provided test code as resoScript.cpp. This is the template, I’ll be using for this little project. Again, as mentioned in last night’s post, having those back quotes expresses the command that’s in between them. If you use forward quotes, the computer is going to wonder why you’re putting down a string. There should be a way to remove the Magick++-config shell script all together, but I wonder if the developers of that script thought it would make the wrapper library more machine agnostic? Anyways, it works. Time to expand on this little program. I should stress this, at this point, my only contribution to this is the makefile. Hopefully someone out there finds it useful. You could just type it all out by hand (every single time), but this way it’s just 2 buttons, the up-arrow then enter.

===

update. I went to check on my nursery, and 3 of my seeds just germinated! OMG!!! ^_^ taking photos. Will update in a future blog post